which simply says we have three versions for installing
nginx-light
nginx-full
nginx-extras
and the deference between them is with the number of modules have been complied to have the binary file. For having less headache you can install nginx-extras so most required modules already complied into it.
If you already have install Nginx, you can check the list of modules complied with Nginx using nginx -V
# the module we installed
# We do not have to load it explicitly
# load_module modules/ngx_http_js_module.so;
and the RTMP server
# RTMP configuration
rtmp {
server {
listen 1935; # Listen on standard RTMP port
chunk_size 4000;
application show {
live on;
# Turn on HLS
hls on;
hls_path /var/www/live/hls;
hls_fragment 3;
hls_playlist_length 60;
# disable consuming the stream from nginx as rtmp
deny play all;
}
}
}
Some notes
It has its own server block
Port is 1935 by default
for each stream we have an application which is show
application show {
create this path /var/www/live/hls for save chuck of vidoes
other options can be vary depending on your requirements
Our web server root path will be /var/www/live
As last step for this section, reload Nignx and make sure everything is fine.
Also here is the complete nginx.conf file if you want to check everything with mine.
We can have our own domain to load the website or just using an IP address. I already have tested with IP address and preferred to have a domain name so I used live.shakiba.net
Setting up SSL/TLS and HTTPS for domain (optional)
We do not have to do so, but again I preferred to have it. You can use any CDN provider and most of them support Free SSL using Lets Encrypt to issue 90 days certificate. So mine endpoint will be https://live.shakiba.net
Configure live.shakiba.net file in sites-available/
Since my chosen domain is live.shakiba.net I will use this name, you have your own. You can see bellow I have the file
root[1]nginx:sites-available# pwd
/etc/nginx/sites-available
root[1]nginx:sites-available# ll
total 32
-rw-r--r-- 1 root root 2412 Aug 24 2020 default
-rw-r--r-- 1 root root 142 Feb 18 10:41 examp1e.ir
-rw-r--r-- 1 root root 1221 Mar 8 13:27 homepc.shakiba.net
-rw-r--r-- 1 root root 4066 Mar 19 11:20 live.shakiba.net
-rw-r--r-- 1 root root 2942 Feb 6 11:36 media.shakiba.net
-rw-r--r-- 1 root root 617 Mar 19 10:42 msa.shakiba.net
-rw-r--r-- 1 root root 1086 Feb 21 15:37 redcursor.ir
-rw-r--r-- 1 root root 887 Mar 8 12:02 shakiba.net
root[1]nginx:sites-available#
basic configuration to check the load of the domain
root directory we have set up is /var/www/live so make sure you have it and add a sample index.html to the location which means we will have /var/www/live/index.html
reload or restart Ningx the load your own domain name or IP address ir you did not have domain name and have set it up on your localhost
Here is a screenshot of mine which I made it fancy, of course you do not have to make it fancy.
We can install Nginx using default Debian packages or using . After installing Nginx make sure it is up and running and load the IP or domain name you have to see the Welcome to nginx! page.