worker_processes auto; rtmp_auto_push on; events {} rtmp { server { listen 1935; notify_method get; application stream { live on; record off; meta copy; hls on; hls_path /mnt/hls/; hls_fragment 3; hls_playlist_length 60; hls_variant _high BANDWIDTH=3500000 RESOLUTION=1920x1080; hls_variant _med BANDWIDTH=2250000 RESOLUTION=1280x720; hls_variant _low BANDWIDTH=1625000 RESOLUTION=640x360; on_publish http://localhost:80/auth; } } } http { server { listen 443 ssl; server_name openwrt.host; ssl_certificate /etc/nginx/fullchain.cer; ssl_certificate_key /etc/nginx/openwrt.host.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location /hls { # Disable cache add_header Cache-Control no-cache; # CORS setup add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Expose-Headers' 'Content-Length'; # allow CORS preflight requests if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Max-Age' 1728000; add_header 'Content-Type' 'text/plain charset=UTF-8'; add_header 'Content-Length' 0; return 204; } types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } root /mnt; } } server { listen 80; location /auth { if ($arg_psk = '56923uwefioghsukd87345hasdf6234') { return 201; } return 404; } } }