-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Installing via Build
ispyisail edited this page Apr 19, 2017
·
18 revisions
Login as Root
sudo su -
Create Build Directory
cd ~ mkdir nginx cd nginx
Build Utilities
apt-get install git gcc make libpcre3-dev libssl-dev
Download & unpack latest nginx-rtmp
git clone git://github.com/arut/nginx-rtmp-module.git
Download & unpack nginx (you can also use svn)
wget http://nginx.org/download/nginx-1.12.0.tar.gz tar zxpvf nginx-1.12.0.tar.gz cd nginx-1.12.0
Build nginx with nginx-rtmp
./configure --add-module=/root/nginx/nginx-rtmp-module/ --with-http_ssl_module --prefix=/usr/local/nginx-streaming/ make make install
Create a configuration file for Nginx
cd /usr/local/nginx-streaming/conf mv nginx.conf nginx.cong.bkp nano nginx.conf
Start nginx Server
/usr/local/nginx/sbin/nginx
To set up RTMP support you need to add rtmp{} section to nginx.conf (can be found in PREFIX/conf/nginx.conf). Stock nginx.conf contains only http{} section
nano /usr/local/nginx/conf/nginx.conf
Use this nginx.conf instead of stock config
worker_processes 1;
events { worker_connections 1024; } rtmp { server { listen 1935; chunk_size 4000; # video on demand for flv files application vod { play /var/flvs; } # video on demand for mp4 files application vod2 { play /var/mp4s; } } } # HTTP can be used for accessing RTMP stats http { access_log /var/log/nginx/access-streaming.log; error_log /var/log/nginx/error-streaming.log; server { # in case we have another web server on port 80 listen 8080; # This URL provides RTMP statistics in XML location /stat { rtmp_stat all; rtmp_stat_stylesheet stat.xsl; } location /stat.xsl { # XML stylesheet to view RTMP stats. # Copy stat.xsl wherever you want # and put the full directory path here root /var/www/; } location /hls { # Serve HLS fragments types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } alias /tmp/app; expires -1; } } }
To be able to see some statistics about the streaming, we must to copy stats.xml in the folder specified in the configuration above
mkdir /var/www cp /root/nginx/nginx-rtmp-module/stat.xsl /var/www/
And (re)start the Nginx server with
/usr/local/nginx-streaming/sbin/nginx