server { # On Spaces Docker, the platform expects the app to listen on 7860 listen 7860; # Increase timeouts to handle long-running operations proxy_connect_timeout 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; # Temp paths are configured globally in nginx.main.conf (http scope) # Buffer settings proxy_buffering on; proxy_buffer_size 4k; proxy_buffers 8 4k; proxy_busy_buffers_size 8k; # Client settings client_max_body_size 10m; client_body_timeout 60s; client_header_timeout 60s; # -- health-check: serve OK directly -- location = /health { default_type text/plain; return 200 'OK\n'; access_log off; } # -- everything else to Gradio -- location / { proxy_pass http://127.0.0.1:7860/; 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_set_header X-Forwarded-Proto $scheme; # Handle WebSocket upgrades for Gradio proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }