글

라벨이 reverse proxy인 게시물 표시

502 Bad Gateway (nginx) - 10 Causes and Fixes

이미지
You got a 502 Bad Gateway (nginx) page instead of your app. That means nginx accepted the browser's request, tried to hand it to your upstream (your Node/PHP-FPM/Gunicorn/Java process), and got back nothing it could use as a valid HTTP response. The critical thing: nginx is almost never the problem . nginx is the messenger telling you the thing behind it is down, not listening where nginx thinks it is, too slow, or returning garbage. So the browser is a dead end for debugging. The answer is always in /var/log/nginx/error.log , and that log names the exact failure mode in one line. This page starts with the one command that identifies your case, then walks the 10 causes in order of how often they bite in production, each with a reproduction, a fix, and a way to confirm it. Error 502 Bad Gateway nginx/1.24.0 Where it happens nginx as a reverse proxy or FastCGI gateway, in front of any upstream: Node.js, PHP-FPM, Gunicorn/uWSGI, Puma, Tomcat, or another nginx. Appears at th...