web123456

NGINX backend configuration ( rtmp-http-flv-moudle) CSRF


#user  nobody;
worker_processes  1;

#error_log  logs/;
#error_log  logs/  notice;
#error_log  logs/  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

#rtmp_auto_push on; #Because Nginx may have multiple sub-processes turned on, this option indicates that when pushing streams, the media streams will be published to multiple sub-processes
#rtmp_auto_push_reconnect 1s;
#rtmp_socket_dir /tmp; 

rtmp_auto_push on;
rtmp {
    server {
        listen 1935;
        chunk_size 4096;
    #ping 30s;
        #notify_method get;

        application live{
            live on;
        }
        application live_one{
             play /tmp/live;
             live on;
             #record off;
        }
    application live_http {
        play http://localhost/live_one;
    }
        application live_two{
    live on;
    #hls on;
    #hls_path /tmp/live;
        }
     
        application hls{
        live on;
        hls  on;

        hls_path  /tmp/live;
        hls_fragment 10s;
        }
    
    }
}

http {
    include       ;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        #server_name  localhost;

        #charset koi8-r;

        #access_log  logs/  main;
# The following two are added to configure http access for live streaming
        location /stat {    
                rtmp_stat all;
                rtmp_stat_stylesheet ;
             }
        location / {
# Note that the path here can not be wrong, directly write the absolute path can be
        root /usr/local/nginx/nginx-rtmp-module/;
        }

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

location /hls {
        types{
        application/ m3u8;
        video/mp2t ts;
        }
        add_header Cache-Control no-cache;
        add_header Access-Control-Allow-Origin *;
        }

        #error_page  404              /;

        # redirect server error pages to the static page /
        #
        error_page   500 502 503 504  /;
        location = / {
            root   html;
        }

        location /live {
            flv_live on;
        add_header Access-Control-Allow-Origin *;
#chunked on; #HTTP protocol with Transfer-Encoding: chunked; mode reply
        }  
    }

    server {
        listen       80;
        server_name  localhost;

        # rtmp stat
        location /stat {    
                rtmp_stat all;
                rtmp_stat_stylesheet ;
             }
        location / {
# Note that the path here can not be wrong, directly write the absolute path can be
        root /usr/local/nginx/nginx-rtmp-module/;
        }

        location hls {
            # Serve HLS fragments
            types {
                application/ m3u8;
                video/mp2t ts;
            }
            root /tmp;
            add_header Cache-Control no-cache;
        }
    location /dash {
        # Serve DASH fragments
        root /tmp;
        add_header Cache-Control no-cache;
    }

        error_page   500 502 503 504  /;
        location = / {
            root   /var/html;
        }
    }


}