Set-up NGINX RTMP server on Ubuntu 18.04

Set-up NGINX RTMP server on Ubuntu 18.04

Install required packages

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

Download NGINX source
http://nginx.org/download/

wget http://nginx.org/download/nginx-1.15.2.tar.gz
tar -zxvf nginx-1.15.2.tar.gz

Download NGINX RTMP module source
https://github.com/arut/nginx-rtmp-module

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

Compile NGINX with the RTMP module

cd nginx-1.15.2
./configure --with-http_ssl_module --add-module=../nginx-rtmp-module
make
sudo make install

Modify NGINX configuration

nano /etc/nginx/nginx.conf
rtmp {
  server {
    listen 1935;
    chunk_size 4096;

    application live {
      live on;
      record off;
    }
  }
}

Reload NGINX configuration

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

Or, restart NGINX configuration

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