直播后台搭建 Centos , Nginx ,RTMP
Step1.安装相关
- # yum install -y pcre pcre-devel
- # yum install -y zlib zlib-devel
- # yum install -y openssl openssl-devel
Step2 Nginx,Nginx Rtmp下载
mkdir /tmp/nginx;
wget http://nginx.org/download/nginx-1.10.2.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
unzip master.zip
tar -xzvf nginx-1.10.2.tar.gz
Step3 安装
./configure --add-module=<path-to-nginx-rtmp-module> --without-http_rewrite_module
Step4 配置Nginx;
rtmp { server { listen 1935; chunk_size 4096; application live { live on; record off; } application live2 { live on; record off; } # video on demand application vod { play /var/flvs; } application vod_http { play http://192.168.31.185/vod;//实际Ip地址 } application hls { live on; hls on; hls_path /tmp/hls; } } } # HTTP can be used for accessing RTMP stats http { server { listen 8080; # This URL provides RTMP statistics in XML location /stat { rtmp_stat all; # Use this stylesheet to view XML as web page # in browser 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 /path/to/stat.xsl/; } location /hls { # Serve HLS fragments types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } root /tmp; add_header Cache-Control no-cache; } location /dash { # Serve DASH fragments root /tmp; add_header Cache-Control no-cache; } } }
5.下载VLC播放
6.下载推流器:目睹直播APP
推流地址:rtmp://ip/hls/test
7.用clappr播放RTMP流