流媒體技術學習筆記之(二)RTMP和HLS分發服務器nginx.conmf配置文件(解決了,只能播放RTMP流而不能夠播放HLS流的原因)


user www www;
worker_processes  1;

error_log  logs/error.log  debug;

#pid        logs/nginx.pid;

events {
    worker_connections  65535;
}

rtmp {
    server {
        listen 1935;

        application live {
                live on;
                record off;
        }

        application live2 {
                live on;
                record off;
        }

       # application hls { #這一塊的注釋,不然的話.m3u8流是沒辦法播放的
       # live on;
            hls on;
            hls_path /tmp/hls;
        # hls_cleanup off; # }

    }
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '[$time_local][$remote_addr][$http_x_forwarded_for] $status "$request" "$http_referer" "$http_user_agent"';

    access_log  logs/access.log  main;

    sendfile        on;
    keepalive_timeout  65;

    server
        {
        listen       80;
        server_name  localhost;

        location /rtmp/stat {
            rtmp_stat all;
            rtmp_stat_stylesheet rtmpstat.xsl;
        }

        location /rtmpstat.xsl {
        }

        location /rtmp/control {
            rtmp_control all;
        }

        location /hls{
            types {
                application/vnd.apple.mpegurl m3u8;
            }
            root /tmp;
            add_header Cache-Control no-cache;
            add_header Access-Control-Allow-Origin *;
        }

        #控制rtmp模塊
        location /control {
            rtmp_control all;
        }
    }

}

 

參照網址:

rtmp與hls流媒體服務器搭建:ubuntu下Nginx搭建初探與rtmp-module的添加

https://my.oschina.net/joshuashaw/blog/516015

 

nginx-rtmp-module 指令詳解

http://blog.csdn.net/aoshilang2249/article/details/51483814


免責聲明!

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



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