worker_processes auto; events { worker_connections 1024; } # RTMP configuration rtmp { server { listen 1935; chunk_size 4096; allow publish all; application live { live on; record off; # Allow playback from anywhere allow play all; # HLS settings (optional, for web playback) hls on; hls_path /tmp/hls; hls_fragment 3; hls_playlist_length 60; # Record streams (optional) record all; record_path /tmp/recordings; record_suffix -%Y%m%d-%H%M%S.flv; } } } # HTTP server for HLS playback http { server { listen 80; # HLS streaming endpoint location /hls { types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } root /tmp; add_header Cache-Control no-cache; add_header Access-Control-Allow-Origin *; } # RTMP statistics location /stat { rtmp_stat all; rtmp_stat_stylesheet stat.xsl; } location /stat.xsl { root /usr/local/nginx/html; } # Status page location / { root /usr/local/nginx/html; index index.html; } } }