How to troubleshoot Nginx 502 reverse proxy errors without resorting to random restarts
Nginx 502 errors often trigger a knee-jerk reaction: restart Nginx, then restart the backend, and if it works for a short time, consider it solved. The problem is that it will happen again, and you might have cleared out useful clues in the logs. When I'm on call, I usually don't touch the services first; I check the error.log to see if it's 'upstream timed out', 'connection refused', or 'no…