Fix: Nginx 502 Bad Gateway
Tail nginx error log for the specific reason
Nginx 502 is an upstream problem. The error log shows the exact cause — connection refused, timeout, or premature close.
Frequently Asked Questions
What causes Nginx 502 Bad Gateway?
Nginx 502 is an upstream problem. The error log shows the exact cause — connection refused, timeout, or premature close.
How to fix Nginx 502 Bad Gateway?
Read `/var/log/nginx/error.log` — look for `connect() failed`, `upstream timed out`, or `prematurely closed connection`. Each maps to a different upstream issue.
Example fix from Kintify Fix
Input: Nginx returns 502 for requests to upstream app
Output: Read `/var/log/nginx/error.log` — look for `connect() failed`, `upstream timed out`, or `prematurely closed connection`. Each maps to a different upstream issue.
Used by developers debugging real production systems