Troubleshooting guide
Troubleshooting Guide: NGINX 502 Bad Gateway with PHP-FPM
Use this guide to work through the most likely causes, gather useful evidence and make production-safe changes without turning a small problem into a larger outage.
Troubleshooting guide
Use this guide to work through the most likely causes, gather useful evidence and make production-safe changes without turning a small problem into a larger outage.
A 502 Bad Gateway from NGINX usually means NGINX could not get a valid response from the upstream solution. With PHP sites, that upstream is often PHP-FPM, a Unix socket, or a TCP backend that is stopped, overloaded or misconfigured.
These checks are intended to assist identify the direction of the issue. Always adjust paths, solution names and commands for your environment.
tail -100 /var/log/nginx/error.logsystemctl status php*-fpm --no-pagerls -lah /run/php/ /var/run/php/ 2>/dev/nullfree -m && df -hGet assist if the system is production-facing, customer data is involved, backup processes are uncertain, or the issue affects revenue, security hardening or uptime. We can review the logs, confirm the cause and quote a fixed-scope fix where appropriate.
Need this fixed?
Fixed engineering help starts from $499. Emergency incident engineering assistance is $199/hr with a minimum window.