Right after a deploy, nginx returns "502 Bad Gateway" on every page.

BeginnerTroubleshootingSite down
Answer

Likely causes → The new app version crashes on start, listens on a different port than nginx's proxy_pass, binds to 127.0.0.1 inside a container, or hasn't finished booting.

Diagnose →

tail -n 50 /var/log/nginx/error.log   # "connect() failed (111: Connection refused) while connecting to upstream"
ss -ltnp | grep 8080
curl -v http://127.0.0.1:8080/healthz
journalctl -u myapp -n 100 --no-pager

Fix → Roll back first, then fix the port or bind address (0.0.0.0), or the startup crash.

Prevent → Health-checked deploys that refuse to switch traffic until the new version answers, and a smoke test in the pipeline that hits a real endpoint.

All Real-World Interview questions Roadmap: Interview readiness

More on Site down