欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

使用nginx搭建點播和直播流媒體服務器的方法步驟

 更新時間:2018年03月21日 09:07:36   作者:限albert  
本篇文章主要介紹了使用nginx搭建點播和直播流媒體服務器的方法步驟,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

環(huán)境   centos7 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協(xié)議,wegt -o nginx-rtmp-module.zip  https://github.com/arut/nginx-rtmp-module/archive/master.zip

4下載清除緩存的模塊 wget -Ongx_cache_purge.zip     https://github.com/FRiCKLE/ngx_cache_purge/archive/master.zip

5.下載nginx  wget http://nginx.org/download/nginx-1.9.0.tar.gz

6 .進入nginx的安裝目錄下 執(zhí)行以下命令./configure --prefix=/usr/local/nginx/--add-module=../nginx-rtmp-module-master --add-module=../ngx_cache_purge-master--add-module=../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

7. 執(zhí)行以下命令編譯文件make && make install ,并修改nginx安裝目錄下的objs下的Makefile 刪除-Werror

9. 修改nginx.conf

10. 通過yum 停止firewalld防火墻并卸載,然后安裝iptables-services修改/etc/sysconfig/iptables文件夾放行80端口

11.nginx 配置如下:

#使用的用戶和組
#user nobody;
#指定工作衍生的進程數(shù),為cpu的核心數(shù)總和
worker_processes 2;
#指定錯誤日志的存放路徑 日志記錄級別[debug,info,notice,warn,error,crit]
error_log  /usr/local/nginx/logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#指定pid存放的路徑
pid    /usr/local/nginx/logs/nginx.pid;
events {
  #使用的網(wǎng)絡I/O模型,linux系統(tǒng)推薦是epoll而freeBSD是kqueue
  use epoll;
  #允許的連接數(shù),最大的高并發(fā)連接數(shù)為worker_processes*worker_connections
  worker_connections 51200;
}

rtmp {
 server {
  listen 1935;
  chunk_size 4096;
  application live {
   live on;
   record off;
  }
  #application live2 {
   #live on;
   #record off;
  #}
  # video on demand
  application media {
   play /usr/local/nginx/html/;
  }
  #application vod_http {
   #play http://192.168.31.185/vod;
  #}
  application hls {
   live on;
   hls on;
   hls_path /tmp/hls;
  }
 }
}

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    80;
    server_name localhost;
    #charset koi8-r;
    #access_log logs/host.access.log main;
    location / {
      root  html;
      index index.html index.htm;
    }

location ~ \.flv$ {
  root /usr/local/nginx/html/media/;  
  flv;
}
location ~ \.mp4$ {
  root /usr/local/nginx/html/media/; 
  mp4;
}

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;
 }

    #error_page 404       /404.html;
    # redirect server error pages to the static page /50x.html
    #
    error_page  500 502 503 504 /50x.html;
    location = /50x.html {
      root  html;
    }


    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #  proxy_pass  http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #  root      html;
    #  fastcgi_pass  127.0.0.1:9000;
    #  fastcgi_index index.php;
    #  fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
    #  include    fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #  deny all;
    #}
  }

  # another virtual host using mix of IP-, name-, and port-based configuration
  #
  #server {
  #  listen    8000;
  #  listen    somename:8080;
  #  server_name somename alias another.alias;

  #  location / {
  #    root  html;
  #    index index.html index.htm;
  #  }
  #}

  # HTTPS server
  #
  #server {
  #  listen    443 ssl;
  #  server_name localhost;

  #  ssl_certificate   cert.pem;
  #  ssl_certificate_key cert.key;

  #  ssl_session_cache  shared:SSL:1m;
  #  ssl_session_timeout 5m;

  #  ssl_ciphers HIGH:!aNULL:!MD5;
  #  ssl_prefer_server_ciphers on;

  #  location / {
  #    root  html;
  #    index index.html index.htm;
  #  }
  #}
}

12. 輸入xxx.xxx.xxx.xxx/*.mp4/*.flv就能播放視頻了

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Nginx與安全相關(guān)的幾個配置小結(jié)

    Nginx與安全相關(guān)的幾個配置小結(jié)

    Nginx提供了一系列的安全相關(guān)參數(shù),可以幫助加固網(wǎng)站安全性,本文主要介紹了Nginx與安全相關(guān)的幾個配置小結(jié),具有一定的參考價值,感興趣的可以了解一下
    2024-02-02
  • nginx日志切割/分割之按天生成及定期刪除日志

    nginx日志切割/分割之按天生成及定期刪除日志

    這篇文章主要給大家介紹了關(guān)于nginx日志切割/分割之按天生成及定期刪除日志的相關(guān)資料,日志文件大會影響訪問的速度和查找難度,文中給出了詳細的代碼示例,需要的朋友可以參考下
    2023-08-08
  • Nginx配置請求頭攜帶原始請求信息的實現(xiàn)

    Nginx配置請求頭攜帶原始請求信息的實現(xiàn)

    本文主要介紹了Nginx配置請求頭攜帶原始請求信息的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2023-12-12
  • Nginx中404頁面的配置及AJAX請求返回404頁面的方法

    Nginx中404頁面的配置及AJAX請求返回404頁面的方法

    404是請求頁面不存在的錯誤代碼,在Nginx中有時處理jQuery中的ajax方法雖然能返回404頁面但錯誤代碼卻返回200,針對此問題我們具體來看一下Nginx中404頁面的配置及AJAX請求返回404頁面的方法
    2016-05-05
  • nginx禁止某個IP訪問站點的設(shè)置方法

    nginx禁止某個IP訪問站點的設(shè)置方法

    近期發(fā)現(xiàn)博客遭到某些人的惡意灌水,頻繁地利用發(fā)帖機器人發(fā)表評論,給博客的管理帶來諸多不便,搜索了一下資料,可以利用nginx的ngx_http_access_module 模塊設(shè)置允許/禁止哪些ip或ip段訪問站點。
    2010-12-12
  • Nginx 配置 ModSecurity 網(wǎng)絡應用防火墻實現(xiàn)

    Nginx 配置 ModSecurity 網(wǎng)絡應用防火墻實現(xiàn)

    這篇文章主要介紹了Nginx 配置 ModSecurity 網(wǎng)絡應用防火墻實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2023-12-12
  • Nginx配置SSL和WSS步驟介紹

    Nginx配置SSL和WSS步驟介紹

    大家好,本篇文章主要講的是Nginx配置SSL和WSS步驟介紹,感興趣的同學趕快來看一看吧,對你有幫助的話記得收藏一下,方便下次瀏覽
    2021-12-12
  • 關(guān)于nginx?反向代理?URL替換方案

    關(guān)于nginx?反向代理?URL替換方案

    這篇文章主要介紹了nginx?反向代理?URL替換方案,本文給大家代理兩種方法一種是直接替換location匹配部分,第二種是使用nginx?的rewrite?模塊,本文給大家介紹的非常詳細,需要的朋友可以參考下
    2022-03-03
  • 關(guān)于nginx負載均衡和反向代理的講解

    關(guān)于nginx負載均衡和反向代理的講解

    這篇文章主要介紹了nginx負載均衡和反向代理,具有很好的參考價值,希望對大家有所幫助,大家一起來看看吧
    2021-09-09
  • Nginx配置SSL證書的方法步驟

    Nginx配置SSL證書的方法步驟

    本文主要介紹了Nginx配置SSL證書,成功配置SSL證書后,您將能夠通過HTTPS加密通道安全訪問Nginx服務器,感興趣的可以了解一下
    2024-02-02

最新評論