Browser shows "502 Bad Gateway"; upstream logs show nothing received.
NGINX accepted the request but the backend (php-fpm, Node, Python, another proxy) did not return a valid response.
curl -v http://127.0.0.1:8000/grep -R "upstream" /etc/nginx/ && grep -R "proxy_pass\|fastcgi_pass" /etc/nginx/tail -n 50 /var/log/nginx/error.logls -la /run/php/ # should match fastcgi_pass pathdocker ps --format "table {{.Names}}\t{{.Ports}}"Health-check upstreams and fail fast; alert on error-log lines containing "upstream".
Full walkthrough: NGINX 502 Bad Gateway: 5 Checks That Find It Fast on the NinjaOps blog.
Spinning up a fresh box to reproduce or escape this error?
Spin up a clean test serverNinjaOps publishes free engineering guides. Some outbound links are affiliate links: they cost you nothing and support the site.
Last reviewed 2026-10-02 · NinjaOps SEO grid · DevOps blog