1.环境搭建
1.下载
https://github.com/winshining/nginx-http-flv-module

选择版本后,下载zip包。上传到服务器。
2.安装
unzip nginx-http-flv-module-1.2.10.zip
#重命名模块
mv nginx-http-flv-module-1.2.10 nginx-http-flv-module
#进入nginx解压后的文件夹
cd /usr/local/nginx-1.18.0/
#移动模块位置
mv /usr/local/project/nginx-http-flv-module /usr/local/
#模块添加到nginx
./configure --add-module=/usr/local/nginx-http-flv-module
#编译安装
make
make install
3.修改nginx配置
rtmp_auto_push on;
# 添加RTMP服务
rtmp {
server {
listen 1935;
application live {
live on;
}
}
}
# 添加http-flv服务
http {
server {
listen 8080;
server_name localhost;
location /live {
flv_live on;
chunked_transfer_encoding on; #open 'Transfer-Encoding: chunked' response
add_header 'Access-Control-Allow-Credentials' 'true'; #add additional HTTP header
add_header 'Access-Control-Allow-Origin' '*'; #add additional HTTP header
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
add_header 'Cache-Control' 'no-cache';
}
}
}
重启nginx
cd /usr/local/nginx/sbin/
./nginx -c /usr/local/nginx/conf/nginx.conf
2.测试
同下面测试方法一致,修改vlc拉流地址即可
CentOS7上配置Nginx+RTMP服务器对接直播设备,
该文详细介绍了如何在CentOS7系统中搭建Nginx服务器,并安装http-flv-module模块,配置RTMP和HTTP-FLV服务,以支持与DRIFTX3等头戴式相机的直播对接。主要步骤包括下载模块、编译安装、修改Nginx配置以及重启服务进行测试。
1449

被折叠的 条评论
为什么被折叠?



