1. 程式人生 > >使用nginx搭建點播和直播流媒體伺服器

使用nginx搭建點播和直播流媒體伺服器

#使用的使用者和組
#user  nobody;
#指定工作衍生的程序數,為cpu的核心數總和
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 {
    #使用的網路I/O模型,linux系統推薦是epoll而freeBSD是kqueue
    use  epoll;
    #允許的連線數,最大的高併發連線數為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;
    #    }
    #}


}

相關推薦

使用nginx搭建點播直播媒體伺服器

#使用的使用者和組 #user  nobody; #指定工作衍生的程序數,為cpu的核心數總和 worker_processes  2; #指定錯誤日誌的存放路徑 日誌記錄級別[debug,info,notice,warn,error,crit] error_log   /usr/local/nginx/lo

搭建nginx服務器直播媒體服務器

proc fig 通過 流媒體服務 負載 代理 rtu def 說明 1、nginx簡單說明   ① Nginx是一款輕量級的Web 服務器/反向代理服務器及電子郵件(IMAP/POP3)代理服務器,並在一個BSD-like 協議下發行。其特點是占有內存少,並發能力強。

搭建一個點播直播媒體伺服器玩玩

> 現在抖音、快手等直播實在是太火了,因此對音視訊的開發非常感興趣,查閱了相關資料,使用Nginx搭建一個簡單的直播跟點播流媒體伺服器,能夠實時推流到伺服器,同時在網頁端播放直播的視訊。 ## 先上效果 ​ 使用OBS軟體錄製電腦桌面操作**推流**到自己搭建的流媒體伺服器,然後在網頁**拉流**播放。當

網易視訊雲:用Nginx搭建flv,mp4,hls媒體伺服器

網易視訊雲是網易傾力打造的一款基於雲端計算的分散式多媒體處理叢集和專業音視訊技術,提供穩定流暢、低時延、高併發的視訊直播、錄製、儲存、轉碼及點播等音視訊的PAAS服務,線上教育、遠端醫療、娛樂秀場、線上金融等各行業及企業使用者只需經過簡單的開發即可打造線上音視訊平臺。今天,

基於SRS搭建RTMP直播媒體伺服器

軟體定位 SRS 定位是運營級的網際網路直播伺服器叢集,追求更好的概念完整性和最簡單實現的程式碼。 運營級:商業運營追求極高的穩定性、良好的系統對接、錯誤排查和處理機制。譬如日誌檔案格式、reload、系統 HTTP 介面、提供 init.d 指令碼、轉發、轉碼和邊緣回多源站

基於 SRS+NG 搭建 HLS 直播媒體伺服器

協議介紹 SRS 支援 HLS/RTMP 兩種成熟而且廣泛應用的流媒體分發方式。 RTMP 指 Adobe 的 RTMP ( Realtime Message Protocol ),廣泛應用於低延時直播,也是編碼器和伺服器對接的實際標準協議,在 PC(Flash)上有最佳觀看

基於Nginx+nginx-rtmp-module+ffmpeg搭建rtmp、hls媒體伺服器

Nginx及nginx-rtmp-module安裝新建目錄mkdir /usr/local/mginx下載cd /usr/local/nginx wget http://nginx.org/download/nginx-1.12.2.tar.gz wget https://c

基於EasyNVR攝像機無外掛直播媒體伺服器實現類似於單點登入功能的免登入直播功能

提出問題 EasyNVR是一套攝像機無外掛直播的流媒體伺服器軟體,他可以接入各種各樣的攝像機,再經過轉化統一輸出無外掛化直播的RTMP、HLS、HTTP-FLV流,同時,EasyNVR為了資料安全,提供了鑑權功能,可以配置成只有登入後才能直播觀看: 但這個時候問題又來了,很多企

ngnix+rtmpModule+ffmpeg實現直播媒體伺服器,並於java後臺關聯

1、ngnix+rtmpModule+ffmpeg安裝配置 1.1、安裝環境 1.2、ngnix安裝 ngnix必要庫安裝 yum -y install openssl-devel pcre pcre-devel zlib zlib-

VLC搭建基於TCP的媒體伺服器

這段時間用到了流媒體資料傳輸的TCP和UDP方式,感覺vlc可以做這方面的demo,這裡總結下,也方便我以後查閱。 簡介 VLC不僅僅是個播放器,也可以作為流媒體伺服器使用。這個網上有相關的資料,我就不多說了。 宣告下本文用的VLC版本:2.0.3 用VLC搭建基於UDP的流媒體伺服器 流媒體伺服器大

利用nginxnginx-rtmp-module搭建媒體伺服器實現直播

轉自:https://www.cnblogs.com/suiyuewuxin/p/7256972.html 使用環境是centos 7.0+nginx;可以實現簡單的流媒體服務。 先下載nginx-rtmp-module拓展: nginx-rtmp-module的官方github地址:h

利用Nginx搭建RTMP視訊直播點播伺服器,ffmpeg推,回看

#下面的server是在http的一級配置標籤下的#上面的註釋對懂nginx的人是廢話,但是如果你不熟悉nginx,建議認真看看http{...# 這裡有一些其他的配置 server { listen 80;#埠 server_name rtmp-server;#設定http

搭建直播伺服器,使用nginxnginx-rtmp-module搭建媒體伺服器

現在,一起學習一下如何自己搭建一個流媒體伺服器吧! 本次搭建流媒體使用的環境是centos 7.0+nginx; 讓我們一起開始奇妙的流媒體之旅吧! 1、下載nginx-rtmp-module: 使用命令: git clone https://gi

obs nginx-rtmp-module搭建媒體伺服器實現直播 ding

歡迎大家來此瀏覽,希望大家一塊在此學習,共同交流進步。 接下來我就簡單跟大家介紹一下利用nginx來搭建流媒體伺服器。 我選擇的是騰訊雲伺服器 1、下載nginx-rtmp-module: 使用命令: git clone https://github.com/

nginx-rtmp-moduleffmpeg搭建媒體伺服器

  萬事俱備,只欠東風,安裝完畢nginx-rtmp-module 和ffmpeg後,就可以開始搭建流媒體伺服器了哈。下面是具體步驟:      一、配置nginx.conf   開啟nginx配置檔案,在裡面新增如下配置: rtmp { server

直播系列4-使用nginx+nginx-rtmp-module+ffmpeg搭建媒體伺服器筆記(一)

第一部分 主要步驟及命令記錄: 2、為了增加對rtmp的支援,下載nginx-rtmp-module,地址:https://github.com/arut/nginx-rtmp-module#example-nginxconf,這個是個開源專案。解壓後,為了和我在網上看到的教程同步,我改了資料夾名字

nginx+ffmpeg搭建媒體伺服器直播

環境 系統環境:opensuse 12 需求 利用nginx和ffmpeg搭建流媒體伺服器(直播流),其他流後續會有所更新 關於用Nginx搭建flv,mp4,hls流媒體伺服器的技術乾貨! 模組:nginx_mod_h264_streaming(支援h264

Nginx】如何使用Nginx搭建媒體伺服器實現直播?看完這篇我會了!!

## 寫在前面 > 最近幾年,直播行業比較火,無論是傳統行業的直播,還是購物、遊戲、教育,都在涉及直播。作為在網際網路行業奮鬥了多年的小夥伴,你有沒有想過如果使用Nginx搭建一套直播環境,那我們該如何搭建呢?別急,接下來,我們就一起使用Nginx來搭建一套直播環境。 ## 安裝Nginx **注

使用Nginx+nginx-rtmp-module+OBS推搭建媒體伺服器

一、安裝Nginx 下載必備安裝包 建立安裝包存放資料夾 cd mkdir /usr/source #建立原始碼目錄 後面的原始碼都放在這個目錄 cd source yum -y install git #安裝git git clone https://github.

nginx-rtmp-module搭建rtmp媒體伺服器

前言 利用開源的nginx-rtmp-module和Nginx搭建流媒體伺服器。Nginx是一個非常出色的http伺服器,nginx-rtmp-module是一個開源的Nginx擴充套件模組,擁有很多功能特性,像接收rtmp推流拉流,hls直播等: 1.RTMP/HLS/MPEG