events { worker_connections 1024; } http { resolver 127.0.0.11 ipv6=off valid=30s; map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 80; server_name www.linearvoid.tv; return 301 https://linearvoid.tv$request_uri; } server { listen 80 default_server; server_name linearvoid.tv localhost 127.0.0.1; root /srv/frontend; index index.html; # Serve static frontend location / { try_files $uri $uri/ /index.html; } # Proxy chat WebSocket location /ws { set $chat_upstream http://chat:3000; proxy_pass $chat_upstream; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } # Local/dev fallback HLS origin. Production media should use MEDIA_DOMAIN. location /hls/ { alias /srv/hls/; add_header Cache-Control "public, max-age=3600"; add_header Access-Control-Allow-Origin "*"; } # Health checks location /health { return 200 "healthy"; add_header Content-Type text/plain; } } }