下载并解压模块:
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip unzip master.zip
停止运行的Nginx服务:
nginx -s stop
配置并编辑:
./configure --add-module=/home/nginx-rtmp-module-master
make
make install
复制Nginx:
## 路径根据自己软件路径自行配置 cp /home/build/nginx-1.11.2/objs/nginx /usr/local/nginx/sbin
配置rtmp服务:
rtmp { #RTMP服务 server { listen 1935; #//服务端口 chunk_size 4096; #//数据传输块的大小 application vod { play /opt/video; #//视频文件存放位置。 } application live{ #直播开启 live on; } } }
检查并启动服务:
nginx -t
nginx
另附我自己用来测试的配置文件,5个输出
worker_processes 1; error_log logs/error.log debug; events { worker_connections 1024; } rtmp { server { listen 1935; application live1 { live on; } application live2 { live on; } application live3 { live on; } application live4 { live on; } application live5 { live on; } application hls { live on; hls on; hls_path temp/hls; hls_fragment 8s; } } } http { server { listen 80; location / { root html; } location /stat { rtmp_stat all; rtmp_stat_stylesheet stat.xsl; } location /stat.xsl { root html; } location /hls { #server hls fragments types{ application/vnd.apple.mpegurl m3u8; video/mp2t ts; } alias temp/hls; expires -1; } } }