Linux nginx+rtmp服务器配置实现直播点播
配置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
相关推荐
fenghuoliuxing0 2016-06-28
liwf 2017-12-22
SoccerZZM 2011-12-11
软件设计 2017-06-22
WebVincent 2020-06-06
BeanJoy 2020-02-24
安防监控ezhf 2019-11-05
yanghan 2014-09-23
bjkamui 2013-07-28
86241847 2019-06-21