How to installing your own nginx RTMP server

How to installing your own nginx RTMP server

Want to stream to more than one streaming platform such as Twitch, Mixer, Smashcast or youtube gaming at once without using restream or switchboard well then a private RMTP server might be your solution

I’m mainly writing this so cause people ask me how I stream to twitch and mixer without stupid delay you get from services like Restream and SwitchBoard. I’ve been running my own RTMP for around 9 months so far and I’ve only ever had 1 issue with it and that’s because of lack of restarts I’ve no got it on a cron to auto restart every month.

Installing nginx

login to your server using a terminal, this can be with ssh or by with a screen and keyboard plugged into it if you have the server box with you, but I personally use a VPS with Contrabo for my server

You need to install the dependencies,

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

Now we can download nginx it doesn’t matter where you put it, but I’ve put mine in /home

$ wget http://nginx.org/download/nginx-1.13.1.tar.gz

You also want to download the RTMP Module from GitHub

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

Now we can extract these files and begin the install

$ tar -zxvf nginx-1.13.1.tar.gz
$ unzip master.zip
$ cd nginx-1.13.1

After ok now we get down to business and configure and install nginx with the RMTP module

$ ./configure –with-http_ssl_module –add-module=../nginx-rtmp-module-master
$ make
$ sudo make install

Ok so now the servers installed, lets start it up

$ sudo /usr/local/nginx/sbin/nginx

Configuring RMTP

Where it says (KEY) replace that with you’re stream key for that platform; if you don’t want to stream on that platform you can remove that line,

you can chose if you want to be able to connect the server and watch the stream using publish but if you’re just using this to restream then can just leave it as off.

rtmp {

server {

listen 1935;
chunk_size 4096;

application live {

live on;
record off;
publish on;
push rtmp://live-lhr.twitch.tv/app/(KEY);
push rtmp://ingest-lon.beam.pro:1935/beam/(KEY);
push tmp://a.rtmp.youtube.com/live2(KEY);

}

}

}

Restart nginx/RTMP

to restart nginx and RTMP you can do the following commands,

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

Leave a Reply

Your email address will not be published / Required fields are marked *