nginx+rtmp搭建直播和点播服务器

nginx地址:
https://github.com/nginx/nginx
nginx插件nginx-rtmp-module地址:
https://github.com/arut/nginx-rtmp-module

依赖:
sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install openssl libssl-dev
sudo apt install zlib1g zlib1g-dev

安装:
./auto/configure --add-module=/path/nginx-rtmp-module --prefix=/usr/local/nginx
make && make install

参考使用步骤:
https://zhuanlan.zhihu.com/p/28009037
https://blog.csdn.net/yeyinglingfeng/article/details/79443373

events {
    worker_connections  1024;
}

// 添加的部分
rtmp {
    server {
        listen 8001; # 之后推流拉流的端口
        chunk_size 4096;

        application live {  #
            live on;
        }

        application vod {
            play /path/vod; #//视频文件存放位置。
        }
    }
}

server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        // 添加的部分
        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }

        location /stat.xsl {
            #为nginx-rtmp-module解压的地址
            root /home/marvin/changqing/nginx-rtmp-module/;
        }

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;
        ...
   }
}
或者
server {
        listen       8000;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        #...................
        #添加的部分
        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }
        location /stat.xsl {
            #为nginx-rtmp-module解压的地址
            root /usr/local/live/nginx-rtmp-module-master/;
        }
        #...................
        location / {
            root   html;
            index  index.html index.htm;
        }
    }

工具:iftop -i 网卡,查看流量
OBS Studio:https://obsproject.com/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值