Nginx 安装 nginx-rtmp-module模块

#安装依赖库
yum install libmaxminddb-devel -y
 
#下载第三方扩展源码
git clone https://github.com/arut/nginx-rtmp-module.git
 
echo "--add-module=/nginx-rtmp-module路径" > /www/server/panel/install/nginx_configure.pl

最后通过面板安装nginx即可,要编译安装!

# nginx -V
nginx version: nginx/1.16.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
built with OpenSSL 1.1.1b  26 Feb 2019
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/www/server/nginx --add-module=/www/server/nginx/src/ngx_devel_kit --add-module=/www/server/nginx/src/lua_nginx_module --add-module=/www/server/nginx/src/ngx_cache_purge --add-module=/www/server/nginx/src/nginx-sticky-module --with-openssl=/www/server/nginx/src/openssl --with-pcre=pcre-8.43 --with-http_v2_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_stub_status_module --with-http_ssl_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt=-Wl,-E --with-cc-opt=-Wno-error --with-ld-opt=-ljemalloc --with-http_dav_module --add-module=/www/server/nginx/src/nginx-dav-ext-module --add-module=/root/nginx-rtmp-module

nginx rtmp配置
放行1935端口

rtmp {
    server {
        listen 1935;
        chunk_size 4096;
        application myapp {     #自定义的名字
            live on;  
       } 
        application live {
            live on;
            record off;
            hls on;
            hls_path /www/wwwroot/存放路径;
            hls_fragment 1s;
            hls_playlist_length 3s; 
        }
}

以下配置解决跨域

 location /stat { 
    	rtmp_stat all;  
        rtmp_stat_stylesheet stat.xsl;  
  }  
  
    location /stat.xsl {    
        root /root/nginx-rtmp-module/;  
    }

    location /live {
            types {
                application/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
            }
            root /www/wwwroot/192.168.10.77;
            add_header Cache-Control no-cache;
	    add_header Access-Control-Allow-Origin *;
	}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值