Fix: Nginx Upstream Timeout (504 Gateway Timeout)
Nginx's default proxy timeout is 60 seconds. Applications that take longer — AI inference, large file processing, database-heavy requests — hit this limit and return 504.
Increase proxy timeouts in Nginx
location / {
proxy_pass http://127.0.0.1:3000;
proxy_connect_timeout 60s;
proxy_send_timeout 300s; # Time to send request to upstream
proxy_read_timeout 300s; # Time to read response from upstream
send_timeout 300s;
}Set timeouts in the specific location block rather than globally — this avoids applying long timeouts to fast endpoints.
nginx -t && systemctl reload nginx
Paste your nginx.conf to detect missing timeout configuration.
Open Tool →