1> 卸载原来安装的nginx软件
cd oneinstack
./uninstall.sh
2> 下载 nginx-rtmp-module
cd /usr/local
git clone https://github.com/arut/nginx-rtmp-module.git
3> 重新配置nginx安装选项
cd oneinstack/include
vim nginx.sh
在31行左右./configure的后面的参数中添加,- -add-module=/usr/local/nginx-rtmp-module
4> 重新安装nginx
cd oneinstack
./install.sh # 选择安装nginx
5> 修改nginx配置
cd /usr/local/nginx/conf
cp nginx.conf nginx.conf.bak
vim nginx.conf
# 在http{前加入
rtmp {
server {
listen 1935; #监听的端口
chunk_size 4000;
application video {#rtmp推流请求路径 (切记路径错了会推不上流)
live on; #开启实时
hls on; #开启hls
hls_path /data/wwwroot/default/video; #rtmp推流请求路径,文件存放路径
hls_fragment 5s; #每个TS文件包含5秒的视频内容
}
}
}
6> 重启nginx
systemctl restart nginx
7> 开放推流的端口(示例端口为1935)
rtmp://192.168.0.1:1935/video/streamname
8> obs 设置推流(ip地址以192.168.0.1为例)
![图片[1]-L25※利用oneinstack搭建基于nginx的rtmp直播服务器-霜林轩](https://www.chiles.top/assets/pic/linux/rtmp.jpg)
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END