zoukankan      html  css  js  c++  java
  • Linux nginx+rtmp服务器配置实现直播点播

    配置nginx.conf
    Nginx服务器安装好后,服务器修改配置文件nginx.conf(默认端口号8080),以支持RTMP和HLS协议,老板们可参考安装好的 rtmp-nginx-module目录下的README.md来配置,本机的路径:/usr/local/nginx/rtmp-nginx-module-master/share/rtmp-nginx-module/README.md

    首先在里面加入rtmp的配置:

    rtmp {  
        server {  
            listen 1935;  
      	#直播
            application live {  
                live on;  
            }
     
            application hls {  
                live on;  
                hls on;  
                hls_path /tmp/hls;  
            } 
     
    	#点播
    	application vod {
                play /tmp/video;
        	}
     
        }  
    } 
    然后,针对hls,还需要在http里面增加一个location配置
    
    location /hls {  
                types {  
                    application/vnd.apple.mpegurl m3u8;  
                    video/mp2t ts;  
                }  
                root /tmp;  
                add_header Cache-Control no-cache;  
    }
    

    注意:修改nginx.conf之后,需重启nginx服务,才会生效:

    $/usr/local/nginx/sbin/nginx -s reload
    
  • 相关阅读:
    2016.11.21随笔
    2016.11.19随笔
    年月日
    导航position:absolute
    360搜索(边框)
    导航代码position:relative
    邮箱注册代码
    2016.11.18随笔
    2016.11.17随笔
    个人简历网页版代码
  • 原文地址:https://www.cnblogs.com/enumx/p/12346700.html
Copyright © 2011-2022 走看看