Nginx 504 Gateway Time-out (upstream timed out)

Proxied backend took longer than `proxy_read_timeout` (default 60s) to respond.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.1.0
Identifier: Nginx 504 Gateway Time-out (upstream timed out) Platform: Nginx
Common Root Causes:
  • Proxied backend took longer than `proxy_read_timeout` (default 60s) to respond.

Interactive Diagnostic Checklist

Verified Solutions:
  1. Optimize slow backend query or move long jobs to async background queues instead of blocking HTTP.
Safe Diagnostic Command:
grep -rn proxy_read_timeout /etc/nginx/
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.

Technical Explanation

Proxied backend took longer than `proxy_read_timeout` (default 60s) to respond. Recommended diagnostic: `grep -rn proxy_read_timeout /etc/nginx/`. Remediation: Optimize slow backend query or move long jobs to async background queues instead of blocking HTTP.

Worked Examples

  • Run `grep -rn proxy_read_timeout /etc/nginx/` to verify root cause before applying the remediation.

Limitations & Assumptions

  • Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.

Source References & Verification

Resource ID: err-nginx-504-upstream-timed-out · Independently verified: 2026-11-25

Related Resources