安裝nginx-rtmp-module模塊與配置


下載並解壓模塊:

wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
unzip  master.zip

停止運行的Nginx服務:

nginx -s stop

配置並編輯:

./configure --add-module=/home/nginx-rtmp-module-master
make
make install

復制Nginx:

## 路徑根據自己軟件路徑自行配置
cp /home/build/nginx-1.11.2/objs/nginx /usr/local/nginx/sbin

配置rtmp服務:

rtmp {                #RTMP服務
    server {
       listen 1935;  #//服務端口
       chunk_size 4096;   #//數據傳輸塊的大小
       application vod {
           play /opt/video; #//視頻文件存放位置。
       }
       application live{ #直播開啟
           live on;
       }
   }
}

檢查並啟動服務:

nginx -t
nginx

另附我自己用來測試的配置文件,5個輸出

worker_processes  1;

error_log  logs/error.log debug;

events {
    worker_connections  1024;
}

rtmp {
    server {
        listen 1935;

                application live1 {
            live on;
        }
		
		application live2 {
            live on;
        }
		
		application live3 {
            live on;
        }
		
		application live4 {
            live on;
        }
		
		application live5 {
            live on;
        }
		
		
        application hls {
            live on;
            hls on;  
            hls_path temp/hls;  
            hls_fragment 8s;  
        }
		
		
    }
	
}

http {
    server {
        listen      80;
		
        location / {
            root html;
        }
		
        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }

        location /stat.xsl {
            root html;
        }
		
        location /hls {  
            #server hls fragments  
            types{  
                application/vnd.apple.mpegurl m3u8;  
                video/mp2t ts;  
            }  
            alias temp/hls;  
            expires -1;  
        }  
    }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM