HOWTO
STREAMING
HLS STREAMING WITH NGINX-RTMP

Published: 20190228
Updated: 20190705 (some links)

Tested on: OS: Ubuntu 16.04 (x86_64)
Software:

-

Right now this HOWTO only deals with passthru streaming.
It is quite possible to also do live transcoding with this software.
If you only do passthru streaming you need very little resources, a small VM is enough.

1. Building server software

$ sudo apt -y install build-essential libpcre3 libpcre3-dev libssl-dev unzip ffmpeg
$ sudo mkdir /usr/local/source
$ mkdir ~/build
$ cd ~/build
$ wget http://nginx.org/download/nginx-1.15.9.tar.gz
$ wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
$ tar zxvf nginx-1.15.9.tar.gz
$ unzip master.zip
$ cd nginx-1.15.9
$ ./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master --prefix=/usr/local/source/nginx-1.15.9
$ make
$ sudo make install

2. Configure NGINX service

$ sudo -i
# cd /usr/local/source/nginx-1.15.9/conf  
# mv nginx.conf nginx.conf-dist
# wget http://techblog.koponen.se/howto/streaming/hls-streaming-with-nginx-rtmp/files/nginx.conf  
# mkdir /scripts  
# cd /scripts  
# wget http://techblog.koponen.se/howto/streaming/hls-streaming-with-nginx-rtmp/files/nginx_rtmp_start.sh  
# wget http://techblog.koponen.se/howto/streaming/hls-streaming-with-nginx-rtmp/files/nginx_rtmp_stop.sh  
# wget http://techblog.koponen.se/howto/streaming/hls-streaming-with-nginx-rtmp/files/nginx_rtmp_restart.sh  
# chmod 0755 /scripts/nginx_rtmp_start.sh  
# chmod 0755 /scripts/nginx_rtmp_stop.sh  
# chmod 0755 /scripts/nginx_rtmp_restart.sh  

Put this line in /etc/rc.local (before "exit 0")

/scripts/nginx_rtmp_start.sh  

3. How to stream to the server

For the sake of this example, let's assume:

Point your encoder to:

4. How to view the stream from the server

For the sake of this example, let's assume:

You have several options: