nginx-http-flv-module(解决浏览器不支持flash插件无法播放rtmp视频的问题)

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拉流地址即可

改为:http://ip:port​​​​​​/live?port=1935&app=live&stream=test

centos7环境搭建nginx+rtmp服务器对接drift X3头戴式相机_醉淸風的博客-CSDN博客

猜你喜欢

转载自blog.csdn.net/Spring_possible/article/details/129505724