worker_processes auto; error_log /var/log/nginx/error.log warn; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; client_max_body_size 100M; upstream backend { server backend:8000; } upstream frontend { server frontend:80; } server { listen 80; # API, HLS-Streams, Auth location ~ ^/(api|hls|login|logout|ping)(/.*)?$ { proxy_pass http://backend; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_read_timeout 300s; # HLS streaming: disable buffering proxy_buffering off; } # Cover images / static media served by backend location /covers/ { proxy_pass http://backend; proxy_set_header Host $host; expires 7d; add_header Cache-Control "public"; } # Frontend (React SPA) location / { proxy_pass http://frontend; proxy_set_header Host $host; } } }