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

}