sapliang 2020-02-22
配置nginx.conf
Nginx服务器安装好后,服务器修改配置文件nginx.conf(默认端口号8080),以支持RTMP和HLS协议,老板们可参考安装好的 rtmp-nginx-module目录下的README.md来配置,本机的路径:/usr/local/nginx/rtmp-nginx-module-master/share/rtmp-nginx-module/README.md
首先在里面加入rtmp的配置:
rtmp { server { listen 1935; #直播 application live { live on; } application hls { live on; hls on; hls_path /tmp/hls; } #点播 application vod { play /tmp/video; } } } 然后,针对hls,还需要在http里面增加一个location配置 location /hls { types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } root /tmp; add_header Cache-Control no-cache; }
注意:修改nginx.conf之后,需重启nginx服务,才会生效:
$/usr/local/nginx/sbin/nginx -s reload