Keywords: nignx (http server); Rtmp,hls (Streaming media Services)
Thanks for the open source, thanks to the fighting people. Now in some of the work of streaming media services, streaming media server set up online tutorials more into the calf, but look carefully, found a lot of comrades posted tutorials have a little problem, there are some are crawling other people's data to get, typesetting also have problems, let novice confused. This article is also a read through some of the high-quality blog to get this share. The following shared URLs are the cited posts, Amway.
1. http://redstarofsleep.iteye.com/blog/2123752
2. http://blog.csdn.net/cjsafty/article/details/9108587
3. http://blog.chinaunix.net/uid-20639775-id-154556.html
Tutorial:
1. Download Nginx, OpenSSL, Pcre, zlib to a directory, such as (/home/user), with the wget command, you can view the various versions below.
Nginx-1.8.0.tar.gzopenssl-1.0.1i.tar.gzpcre-8.37.tar.gzzlib-1.2.8.tar.gz
2. Unzip the tar.
TAR-ZXVF NGINX-1.8.0.TAR.GZTAR-ZXVF OPENSSL-1.0.1I.TAR.GZTAR-ZXVF PCRE-8.37.TAR.GZTAR-ZXVF zlib-1.2.8.tar.gz
3. Git under Nginx-rtmp-module (https://github.com/arut/nginx-rtmp-module), specific.
4. Enter Nginx, configure, make and make install.
./configure--prefix=/usr/local/nginx--with-pcre=/home/user/pcre/pcre-8.37--with-zlib=/home/user/zlib/ zlib-1.2.8--with-openssl=/home/user/openssl/openssl-1.0.1i--add-module=/home/user/nginx-rtmp-modulemakemake Install
5. Go to (/usr/local/nginx/conf), configure the Conf, below a simple full version of the
#user nobody;worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid;events { worker_connections 1024;} [email protected]@ @rtmp { server { listen 1935; application myapp { live on; } application hls { live on; hls on; &nbSp;hls_path /tmp/hls; } }}[email protected]@ @http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; [email protected]@@ location /hls { types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } root /tmp; add_header Cache-Control no-cache; } [email protected]@@ location / { root html; index index.html index.htm; }}
The added part has been marked on it.
6. Enter (/usr/local/nginx/sbin) operation
./ngnix
7. Can see the port occupancy, 80,1935 is not listening
Netstat-ltn
8. More Tests
1) send the rtmp stream to the server
Rtmp://ip/myapp/test
MyApp is set in ngnix.conf application, and stream is test is custom.
2) Receive HLS Stream
Http://ip/hls/test.m3u8
HLS is the location within the HTTP settings, access to the Linux (/tmp/hls), test is the above rtmp test, if the above is haha, the following is haha.
3) Ngnix homepage
Http://ip
later: There are tutorials in the./configure can not need zlib and pcre, this I have not tried, really do not need these two modules of children's shoes can not be added. In addition, follow the above tutorial is not installed correctly can contact my email ([email protected]), or comments below. Finally, some steps can not be completed, add sudo bar, this reason oneself think:)
Rtmp and HLS Streaming media Server Setup: an initial discussion on the Nginx erection in Ubuntu and the addition of Rtmp-module