Fix: Nginx 502 Bad Gateway Error
Nginx returns 502 when it can't get a valid response from the upstream server. The upstream is either not running, on the wrong port, or unreachable on the configured address.
Diagnosis checklist
# 1. Is the upstream service running? docker ps | grep your-service systemctl status your-service # 2. Is it listening on the expected port? ss -tlnp | grep 3000 # 3. Can Nginx reach it? curl -sI http://127.0.0.1:3000/ # 4. Check Nginx error log: tail -50 /var/log/nginx/error.log | grep upstream