rtmp配制

user  robot robot;
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    access_log  off;

    index  index.php index.html index.htm;
    server {
        listen       80;
        server_name  local.hflxhn.com;
        root   /var/www/hflxhn/api_hflxhn/public;

        location / {
            if (!-e $request_filename) {
                rewrite ^(.*)$ /index.php/index/$1 last;
            }
        }

        location /backmanage {
            if (!-e $request_filename) {
                rewrite ^(.*)$ /index.php/$1 last;
            }
        }

        location ~ \.php(.*)$ {
            fastcgi_index  index.php;
            #fastcgi_pass   127.0.0.1:9000;
            fastcgi_pass   unix:/opt/lnmp/php7.4/var/run/www.sock;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO $1;
            include        fastcgi_params;
        }

        location /uploads {
            alias   /var/www/hflxhn/api_hflxhn/runtime/storage/;
        }
    }

    server {
        listen       8088;
        server_name  video.com;
        add_header Cache-Control no-cache;
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Headers X-Requested-With;
        add_header Access-Control-Allow-Methods GET,POST,OPTIONS;

        location / {
            root   /var/www/video;
            index  index.html;
        }

        location /flv {
            alias   /var/www/flv/demo;
        }

        location /live {
            flv_live on;
        }
    }
}

rtmp_auto_push on;
rtmp_auto_push_reconnect 1s;
rtmp_socket_dir /tmp;
rtmp {
    out_queue 4096;
    out_cork 8;
    max_streams 128;
    drop_idle_publisher 30s;

    server {
        listen 1935;

        application hls {
            live on;
            hls on;
            gop_cache off;
            gop_max_frame_count 256;
            gop_max_video_count 128;
            gop_max_audio_count 128;
            # wait_key on;
            hls_path /var/www/video/hls;
            hls_fragment 2s;
            hls_playlist_length 10s;
        }
    }
}
上一篇:nginx高并发配置详解


下一篇:ubuntu通过nginx部署fastcgi程序