zoukankan      html  css  js  c++  java
  • centos 7下nginx搭建流媒体服务器【动态添加模块】

    1、安装nginx依赖包 yum install gcc gcc-c++ openssl-devel zlib-devel pcre pcre-devel yamdi

    2.下载解压nginx_mod_h264_streaming,让nginx支持flv,mp4流播放
    wget http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gz
    解压后需要修改src目录下的ngx_http_streaming_module.c文件,将r->zero_in_uri所在的if语句注释掉

    3.下载解压nginx-rtmp-module,让nginx支持rtmp/hls协议,
    wegt -o nginx-rtmp-module.zip https://github.com/arut/nginx-rtmp-module/archive/master.zip

    4下载清除缓存的模块 wget -O ngx_cache_purge.zip https://github.com/FRiCKLE/ngx_cache_purge/archive/master.zip

    5、使用./nginx -V查看已经配置安装的模块
    在原有基础添加模块 --add-module=...
    流媒体搭建模块如下:
    ./configure --add-module=/usr/local/nginx-1.13.1/additional/nginx-rtmp-module-master --add-module=/usr/local/nginx-1.13.1/additional/ngx_cache_purge-master --add-module=/usr/local/nginx-1.13.1/additional/nginx_mod_h264_streaming-2.2.7 --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_flv_module

    6、使用make命令【已经安装了nginx就不要使用make install命令】

    7、备份原有nginx执行文件
    cp nginx nginx.bak【在/usr/local/nginx/sbin目录下】

    8、更新新模块执行文件
    cp /objs/nginx /usr/local/nginx/sbin/ 【在安装目录下】

    注:

    访问可能出现的问题:
    403 forbidden
    no permit

    解决方法:将nginx.conf头部文件修改为:user nginx[必须是linux上存在的用户,否则无权限访问(播放)文件]

    nginx.conf
    
    rtmp模块实例
    rtmp { #RTMP服务
      server {
        listen 1935; #服务端口 
        chunk_size 4096; #数据传输块的大小
    
        application vod {
          play /data/movie/vod/; #视频文件存放位置。
        }
      }
    }
    
    http模块实例
    location /video/ {
      #注意root 与 alias区别:
      #如果以下变成root则访问test.mp4文件地址为:
      #/data/movie/vod/video/test.mp4文件地址为:
      #否则alias时为:/data/movie/vod/test.mp4
      alias /data/movie/vod/;
      autoindex on;#这个默认是off的 意思是禁止访问目录
    }
    

      

    大道,在太极之上而不为高;在六极之下而不为深;先天地而不为久;长于上古而不为老
  • 相关阅读:
    unicode编码表
    范仁义js课程---17、赋值运算符
    如何从Apache官网下载windows版apache服务器
    php开发工具zendstudio13破解补丁
    如何彻底删除SVN中的文件和文件夹(附恢复方法)
    proguard.cfg 配置文件
    VMware-workstation-full-12.0.1-3160714
    《吉他自学三月通》学习指导
    [Windows] Adobe Photoshop CC 2015官方原版下载 附破解补丁&破解教程
    【求神——唐伯虎点秋香】
  • 原文地址:https://www.cnblogs.com/GodBug/p/7384647.html
Copyright © 2011-2022 走看看