วันจันทร์ที่ 5 ตุลาคม พ.ศ. 2558

How to compile nginx with nginx-rtmp-module

Prepare environment for compile.
$ sudo apt-get update
$ sudo apt-get install libpcre3-dev libatomic-ops-dev libgeoip-dev geoip-bin geoip-database geoip-database-extra libperl-dev libssl-dev libxml2-dev libxslt1-dev

Create directory src

$ mkdir src

Download Nginx (last version)

$ cd src
$ wget http://nginx.org/download/nginx-1.9.5.tar.gz
$ tar -xvzf nginx-1.9.5.tar.gz

Git Clone nginx-rtmp-module

$ git clone https://github.com/arut/nginx-rtmp-module.git


Change current to nginx-1.9.5

$ cd nginx-1.9.5

Run configure

$ ./configure --prefix=/usr/local/nginx --user=www-data --group=www-data --with-select_module --with-poll_module --with-threads --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module  --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-pcre --with-pcre-jit --with-md5-asm --with-sha1-asm --with-libatomic --with-pcre --with-stream --with-stream_ssl_module --with-http_v2_module --add-module=../nginx-rtmp-module

Run make to compile

$ make

Install nginx to /usr/local/nginx

$ sudo make install

Config Nginx on /usr/local/nginx/conf/nginx.conf

$ sudo nano /usr/local/nginx/conf/nginx.conf


Config for streaming server see on nginx-rtmp-module wiki

Web path /usr/local/nginx/html

Start nginx service

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

Stop nginx service

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


Reference
Nginx

nginx-rtmp-module (source code)

nginx-rtmp-module (wiki)

Streaming with nginx-rtmp-module