The process of doing a lot of problems, the environment actually needs Nginx can, and then is in the playback of the problem, m3u8 format, Mac direct access to support, Apple system native H5 support m3u8, there is also direct access to mobile phone support! But other PC side does not support, tried a lot of not, finally found a support m3u8 format H5 play (https://github.com/huangyaoxin/hLive download on the line js.css loading OK)!
Reference: http://blog.csdn.net/zph1234/article/details/52846223 using Nginx and nginx-rtmp-module to build a streaming media server
First of all, download first Nginx-rtmp-module
Official GitHub Address: Https://github.com/arut/nginx-rtmp-module
Clone https://github.com/arut/nginx-rtmp-module.git
I downloaded to the root directory, look at the situation to be good!
Second, installation: Nginx
Nginx's official website is: http://nginx.org/en/download.html
wget http://nginx.org/download/nginx-1.8.1.tar.gz tar-zxvf Nginx-1.8.1.tar. GZ cd nginx-1.8.1 ./configure--prefix=/usr/local/nginx --add-module=. /nginx-rtmp-module --with-http_ssl_module && make install
Problem: is already installed Nginx, how to reconfigure the third-party module, find a write a very comprehensive blog!
http://blog.csdn.net/ystyaoshengting/article/details/48436409 How to install nginx Third party module--add-module
(./configure --prefix=/Your installation directory --add-module=/third-party module directory)
Installation may cause error without installing OpenSSL, you need to execute the command:
Yum-y Install OpenSSL Openssl-devel
Third, modify Nginx configuration file
Vi/usr/local/nginx/conf/nginx.conf
Add the following to the file ( loaded on the last side of the line, standalone module)
rtmp {server {listen 1935; # listening port chunk_size 4000; Application HLs { # rtmp push-Flow request path live on; HLS on; Hls_path /usr/local/nginx/html/HLS; Hls_fragment 5s; } } }
There is this path, look at your own actual situation of the access to the root directory, my is/usr/local/nginx/html/this path,
However ,/usr/local/nginx/html/HLS certainly does not have this directory, so it is necessary to build a catalog HL s for a drift file, and to change the permissions to read and Write permissions
To modify the server module in http:
The main change is the port number, changed to 81, and then the root directory according to the actual situation change!
Server {Listen81; server_name localhost; #CharSet Koi8-r; #Access_log Logs/host.access.log Main; Location/{root/usr/local/nginx/html; Index index. HTML index.htm; } #Error_page 404/404.html; #Redirect Server error pages to the static page/50x.html #Error_page 502 503 504/50x.html; Location=/50x.HTML {root HTML; }
Then start the Nginx:
/usr/local/nginx/sbin/nginx
For more rtmp parameters, refer to: Https://github.com/arut/nginx-rtmp-module/wiki
Four, and then began to push the flow
With the use of push-flow software, I use OBS, according to OBS operation can!
Fill in the information in the set-and-stream: The URL is rtmp://xxx:1935/hls,xxx for your server's IP address, and HLS is used to store streaming media.
The key can be filled in a random, used to play the time to identify which streaming media, such as fill test.
Once filled in, click Start Streaming to indicate that our streaming server has been built successfully.
V. Watching live
If Mac Direct Browser can access http://xxx:81/hls/test.m3u8 to watch live, where xxx is your server IP address,
Direct access to files on the phone can also be seen!
And then other H5 vadio need to download support m3u8 format of play, I was in https://github.com/huangyaoxin/hLive this, very useful! Looking for a lot of no, this can!
[Linux] [Nginx] through the Nginx expansion nginx-rtmp-module simple to do a live streaming media