worker_processes 1; #Nginx进程数,建议设置为等于CPU总核数 events { worker_connections 1024; #工作模式与连接数上限 } rtmp_auto_push on; #RTMP服务 rtmp{ server{ listen 1935; #服务端口 chunk_size 4096; #数据传输块的大小 application vod{ play ./vod; #视频文件存放位置 } application live{ live on; #开启直播 } } } #HTTP服务 http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } location /live_hls{ types{ #m3u8 type设置 application/vnd.apple.mpegurl m3u8; #ts分片文件设置 video/mp2t ts; } #指向访问m3u8文件目录 alias ./m3u8File; add_header Cache-Control no-cache; #禁止缓存 } location /control{ rtmp_control all; } location /stat{ rtmp_stat all; rtmp_stat_stylesheet stat.xsl; } location /stat.xsl{ root ./nginx-rtmp-module-master; } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }