![]() |
|
Guide Fix 502 Bad Gateway in CloudPanel - Printable Version +- AdminsForum (https://adminsforum.com) +-- Forum: Free & open-source control panels (https://adminsforum.com/Forum-free-open-source-control-panels) +--- Forum: CloudPanel (https://adminsforum.com/Forum-cloudpanel) +---- Forum: CloudPanel Guides & Tutorials (https://adminsforum.com/Forum-cloudpanel-guides-tutorials) +----- Forum: CloudPanel Sites & Nginx Guides (https://adminsforum.com/Forum-cloudpanel-sites-nginx-guides) +----- Thread: Guide Fix 502 Bad Gateway in CloudPanel (/Thread-guide-fix-502-bad-gateway-in-cloudpanel) |
Fix 502 Bad Gateway in CloudPanel - DEV - 10-16-2026 A 502 Bad Gateway error in CloudPanel usually means a gateway could not obtain a usable response from its upstream. Find which hop failed before changing PHP limits or restarting the server. This is a diagnostic guide for CloudPanel v2, checked against the official settings, vhost and PHP-FPM documentation. The diagram is an original workflow illustration; it is not a screenshot of a newly reproduced outage. AdminsForum diagnostic workflow: identify the failed hop, check its backend, then verify recovery. 1. Confirm the affected site and capture one failure Note the exact domain, URL, time, status and last deployment. In Sites → your site → Logs, update the Nginx error log immediately after one failed request. Also inspect the access log and application/PHP log. Follow our CloudPanel logs walkthrough if this is your first time using the viewer. Is every site failing, one site failing, or only PHP/dynamic requests failing? Existing static assets may work while PHP-FPM is unavailable. That narrows the search but does not identify the cause on its own. If a CDN is present, distinguish its gateway error from the origin response using the origin's matching log entries. Keep the origin firewall protections in place. 2. Read the message and upstream address Common log fragments and their next checks:
3. PHP sites: check the selected PHP-FPM version Open the site's Settings and note its selected PHP version. The version returned by php -v in SSH can be different from the version serving the website. Discover installed service units: Code: systemctl list-units --type=service --all | grep -Ei 'php.*fpm'Code: sudo systemctl status php8.3-fpm.service --no-pager -l
sudo journalctl -u php8.3-fpm.service --since '30 minutes ago' --no-pager -n 100Compare the site's Vhost upstream with the pool's listen setting. An administrator can inspect the version's pool files; substitute the actual version: Code: sudo grep -RnsE '^[[:space:]]*listen[[:space:]]*=' /etc/php/8.3/fpm/pool.d/Code: sudo ss -ltnp
sudo ss -lxnp4. Node.js / Python sites: match App Port and process In the site's Settings, compare App Port with the application's configured listening port and the upstream address from the log. Check the application's own process manager as the site user. For an app managed with PM2: Code: pm2 list
pm2 logs APP_NAME --lines 50 --nostreamFor an HTTP-speaking app listening on local port 3000, a read-only local request can help: Code: curl --max-time 10 -sS -D - -o /dev/null http://127.0.0.1:3000/5. Reverse proxies, Varnish and resource failures For a Reverse Proxy site, check its configured target URL, protocol, hostname and port. A hostname-based upstream may depend on DNS and routing. For a site using Varnish, follow the address of the failing hop rather than assuming Nginx connects directly to PHP. If the process repeatedly disappears, check resources and kernel messages: Code: free -h
df -h
df -i
sudo journalctl -k --since '30 minutes ago' --no-pager | grep -Ei 'out of memory|oom|killed process'6. Apply one justified correction, then verify
Code: sudo systemctl restart php8.3-fpm.service
sudo systemctl status php8.3-fpm.service --no-pager -lNeed help? Share the CloudPanel/OS versions, site type, PHP version or app runtime, exact error fragment, failing upstream (redacted as needed), time, recent change and what you already checked. Never share credentials or private keys. References CloudPanel site settings and App Port CloudPanel Vhost Editor PHP-FPM pool configuration Nginx proxy configuration |