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

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

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

2、 下载nginx-1.9.15.tar.gz

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

3、 下载 nginx-rtmp-module

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

4、解压

  tar -zxvf nginx-1.9.15.tar.gz

  unzip master.zip

  cd nginx-1.9.15

5、编译

  ./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master

  make

  sudo make install

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

  sudo /usr/local/nginx/sbin/nginx

7、配置nginx使用RTMP

  vi /usr/local/nginx/conf/nginx.conf

  拷入下列内容:

rtmp {

    server {

        listen 1935;

        chunk_size 4096;

application live {

          live on;

          record off;

        }

    }

}

8、重启nginx服务器

  sudo /usr/local/nginx/sbin/nginx -s stop

  sudo /usr/local/nginx/sbin/nginx

9、测试

OBS 推流: rtmp://192.168.18.116/live/test001

VLC 拉流: rtmp://192.168.18.116/live/test001

05-19 19:30