nginx rtmp 环境搭建

来源:互联网 发布:怎么通过网络赚钱 编辑:程序博客网 时间:2024/05/01 10:58

环境:cetos 6.5

安装包目录

nginx 包下载地址: http://nginx.org/en/download.html

nginx rtmp module 包下载地址: https://github.com/arut/nginx-rtmp-module


将两个安装包解压

进入nginx 解压后的目录

./configure  --add-module=nginx rtmp module解压目录 ---prefix=安装目录

make && make install


即将nginx rtmp 插件安装完成

测试config (示例) nginx.conf

worker_processes  1;
events {
    worker_connections  1024;
}

rtmp {
        access_log logs/rtmp_access.log new;

        server {
                listen 1935;
               chunk_size 4096;
                timeout    10s;
                ping 2m;
                application live {

                        live on;
                       wait_key on;
                      drop_idle_publisher 10s;

                        hls on;
                        hls_fragment 5s;
                    hls_nested on;
                        hls_sync 100ms;
                        hls_playlist_length 30s;
                        hls_path /tmp/live;
                }

    }

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

    sendfile        on;
    server {
                listen       80;
                server_name localhost;

        keepalive_timeout  65;
        location / {
                root   html;
                index  index.html index.htm;
        }
        location /crossdomain.xml{
                root html;
}
        location ~ /live/([0-9|a-z]+)/([0-9|a-z|-]+)\.m3u8 {
                root /tmp;
                add_header Cache-Control max-age=5;
                default_type  application/x-mpegURL;
            }
        location ~ /live/([0-9|a-z]+)/([0-9|a-z|-]+)\.ts {
            root /tmp;
            add_header Cache-Control max-age=5;
            default_type  video/MP2T;
        }

  }

在nginx安装目录下执行

./sbin/nginx -c conf/nginx.conf

即nginx rtmp 插件启动


测试








原创粉丝点击