# Run nginx in a way compatible with non-root Docker environments # like Hugging Face Spaces. # Send logs to /tmp to avoid permission issues in /var/log/nginx error_log /tmp/error.log; pid /tmp/nginx.pid; worker_processes 1; events { worker_connections 1024; } http { # Move access logs as well access_log /tmp/access.log; include /etc/nginx/mime.types; default_type application/octet-stream; sendfile on; # Explicitly set paths for temporary files to /tmp # This prevents crashes if /var/lib/nginx/... is not writable client_body_temp_path /tmp/client_temp; proxy_temp_path /tmp/proxy_temp; fastcgi_temp_path /tmp/fastcgi_temp; uwsgi_temp_path /tmp/uwsgi_temp; scgi_temp_path /tmp/scgi_temp; # Increase timeouts for large video uploads client_max_body_size 250m; proxy_read_timeout 300s; proxy_send_timeout 300s; proxy_connect_timeout 30s; server { listen 7860; # ── API & WebSocket → FastAPI :8000 ────────────────────────────── location /api/ { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_read_timeout 300s; } location /ws/ { proxy_pass http://127.0.0.1:8000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; proxy_read_timeout 120s; } # ── Everything else → Next.js :3000 ───────────────────────────── location / { proxy_pass http://127.0.0.1:3000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } } }