配置nginx-rtmp流媒体服务器(宝塔面板配置教程)

1.在宝塔面板中安装带nginx的服务器

 

 2.在宝塔面板中卸载nginx(因为nginx-rtmp和nginx的配置不同,并且宝塔面板中不支持安装nginx-rtmp)

 

 

 

 

3.开始预下载nginx

(1)进入~,输入命令cd ~ 

 

 

(1.5)没有git请输入以下命令

    yum -y install git

(2)开始下载nginx-rtmp

git clone https://github.com/arut/nginx-rtmp-module.git

(3)开始修改下载配置文件

vim /www/server/panel/install/nginx.sh

 (4)在./configure后添加如下内容

 

 

--add-module=/root/nginx-rtmp-module

(5) wq 保存退出

 

 (6)使用sh命令安装

 

 

4推流配置

(1)新建网址

 

 (2)在nginx.conf中填入以下配置

rtmp {
    server {
        listen 1935;
        application live {
            live on;
            hls on;
            hls_path /www/wwwroot/test.sshouxin.xyz;
        }
    }
}
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/test.sshouxin.xyz;
            add_header Cache-Control no-cache;
        add_header Access-Control-Allow-Origin *;
    }

 

 

 

 (2)重载配置和重启

 

 

(3)使用推流软件(推拉流过程省略,如有需要,可以评论联系我,我可以再补个博文)

往rtmp://192.168.0.1.104:1935里面推流,就可以在test.sshouxin.xyz的网址目录找到文件,

posted @ 2023-03-09 21:32  mingruqi  阅读(917)  评论(0编辑  收藏  举报