Running your own live video server in Ubuntu 20.04 with nginx-rtmp-module


Open Source is all about taking back control of different aspects of our digital life. One part of the internet that’s in serious need of a open source overhaul is media platforms. If we aren’t paying for them, we’re watching ads for them, and very rarely do they value your privacy. Lets start to make a streaming video server with NGINX and the NGINX-RTMP-Module. This will get us to the point where we can stream from OBS (or other RTMP compatible streaming software / service) to our server, and ingest it via RTMP using VLC.

Lets get started.

Open up a terminal, preferably in a fresh Ubuntu 20.04 installation, and just to get things up to date, lets do:

sudo apt update
sudo apt upgrade




Then, lets install nginx and the rtmp module:

sudo apt install nginx libnginx-mod-rtmp

Open up the nginx configuration file:

sudo nano /etc/nginx/nginx.conf

Add the following to the bottom of the configuration and save:

rtmp {
        server {
                listen 1935;
                chunk_size 4096;

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

After saving, in the terminal we will run:

service nginx reload

Now stream to the server with OBS using the following stream credentials:

Server: rtmp://{{yourserveripaddress}}/live
Stream Key: {{anything}}

Hit “Start Streaming” in OBS, and you should be able to view the stream in VLC with the following URL:

rtmp://{{yourserveripaddress}}/live/{{anything}}

Enjoy the stream!

Next, we’ll be making this a HLS stream capable of streaming to any modern website. If you have any questions, or further tips, be sure to leave them in the comments!

Leave a Reply