下载nginx-http-flv-module
https://gitee.com/mirrors/nginx-http-flv-module.git
将模块编译进NGINX
./configure --add-module=../nginx-http-flv-module
make
make install
测试nginx-1.10.3是可用的(可参考上篇)
./configure --prefix=/usr/local/nginx --with-debug --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.0.2k --add-module=../nginx-http-flv-module
nginx增加配置
其中/
、/flv
是增加项,/flv
是必填项
http {
include mime.types;
default_type application/octet-stream;
#log_format main ‘$remote_addr - $remote_user [$time_local] "$request" ‘
# ‘$status $body_bytes_sent "$http_referer" ‘
# ‘"$http_user_agent" "$http_x_forwarded_for"‘;
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 8100;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location /flv {
add_header ‘Access-Control-Allow-Origin‘ ‘*‘;
flv_live on;
chunked_transfer_encoding on;
}
nginx pull配置
这一步很重要,转播cctv6
rtmp {
server {
listen 1935;
#直播
application live {
live on;
pull rtmp://58.200.131.2:1935/livetv/cctv6;
}
VLC测试
一定要注意,链接地址、端口号、应用名称对应关系