Nginx: [error] no live upstreams while connecting to upstream (503/502)
All servers in an upstream group are marked unavailable, so Nginx has nothing to proxy to.
no live upstreams while connecting to upstream[error] no live upstreams while connecting to upstream502 Bad Gateway no live upstreamsnginx no live upstreams while connecting to upstream client Meaning
After repeated failures (max_fails/fail_timeout), Nginx temporarily marks servers down. Fix the backends, tune max_fails=3 fail_timeout=10s, or add health checks. If you have a single server in the upstream, one failure can mark it down — consider max_fails=0 or using proxy_pass directly.
Common causes
- All upstream servers failed health/connection checks
max_failstoo low with intermittent errors- Backend overloaded/crashed
- Wrong upstream addresses
- Single-server upstream marked down
⚡ Quick fix
- Fix/restart backends and read the preceding connect() errors
- Tune
max_fails/fail_timeoutor setmax_fails=0for single server - Add more servers and health checks
Detailed fix by platform
Nginx
upstream app { server 127.0.0.1:3000 max_fails=3 fail_timeout=10s; keepalive 16; }
How to diagnose
- Servers — Reachable?
- max_fails — Reached?
- Count — Single backend?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- 502 HTTP 502 Bad Gateway
- connect() failed (111: Connection refused) while connecting to upstream Nginx: [error] connect() failed (111: Connection refused) while connecting to upstream, upstream: "http://127.0.0.1:3000/"
- ModSecurity: Access denied with code 403 Nginx/Apache: ModSecurity: Access denied with code 403 (phase 2). Matched "Operator GE matched 5 at TX:anomaly_score"
Most viewed in Nginx / Apache
- nginx: [emerg] unknown directive Nginx: nginx: [emerg] unknown directive "x" in /etc/nginx/sites-enabled/x:12 — configuration file test failed
- upstream timed out Nginx: upstream timed out (110: Connection timed out) while reading response header from upstream
- AH00558 Apache: AH00558: apache2: Could not reliably determine the server's fully qualified domain name
Other ways to find it
Where this error sits
Origin: Edge & web server. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026