#user nobody; worker_processes 1; daemon off; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } rtmp { server { listen 1935; chunk_size 4000; # TV mode: one publisher, many subscribers application flvplayback { # enable live streaming live on; # drop if stream timed out drop_idle_publisher 10s; # record first 1K of stream record all; record_path /tmp/av; record_max_size 100K; # append current timestamp to each flv record_unique on; allow publish all; allow play all; hls on; hls_path /tmp/hls; dash on; dash_path /tmp/dash; } } } 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; } # This URL provides RTMP statistics in XML 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 /usr/local/nginx/html/stat.xsl/; } location /hls { # Serve HLS fragments types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } add_header 'Access-Control-Allow-Origin' '*'; root /tmp; location ~* \.(m3u8)$ { expires 3s; add_header Cache-Control "public"; add_header 'Access-Control-Allow-Origin' '*'; } location ~* \.(ts)$ { expires 120s; add_header Cache-Control "public"; add_header 'Access-Control-Allow-Origin' '*'; } } location /dash { # Serve DASH fragments add_header 'Access-Control-Allow-Origin' '*'; root /tmp; add_header Cache-Control no-cache; } } }