Linux上用nginx搭建RTMP服务器

参考文章:https://obsproject.com/forum/resources/how-to-set-up-your-own-private-rtmp-server-using-nginx.50/

我的环境ubuntu

1、 安装编译 nginx 所需要的库

 sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev
  • 1
  • 1

2、 下载 nginx-1.9.15.tar.gz

wget http://nginx.org/download/nginx-1.9.15.tar.gz
  • 1
  • 1

3、 下载 nginx-rtmp-module

wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
  • 1
  • 1

4、解压

tar -zxvf nginx-1.9.15.tar.gz
unzip master.zip cd nginx-1.9.15
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

5、编译

./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master make sudo make install
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

6、启动nginx,检测nginx是否能成功运行

 sudo /usr/local/nginx/sbin/nginx
  • 1
  • 1

7、配置nginx使用RTMP, /usr/local/nginx/conf/nginx.conf

rtmp {
        server {
                listen 1935;
                chunk_size 4096;

                application live {
                        live on; record off; } } }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

8、重启nginx服务器

sudo /usr/local/nginx/sbin/nginx -s stop
sudo /usr/local/nginx/sbin/nginx
  • 1
  • 2
  • 1
  • 2

9、测试 
OBS 直播设置

Streaming Service: Custom
Server: rtmp://<your server ip>/live //例如:rtmp://192.168.18.116/live Play Path/Stream Key: test
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

VLC 播放设置

Network Stream URL: rtmp://%your_server_ip%/live/test
例如:rtmp://192.168.18.116/live/test
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值