![]() |
|
Guide Fix 504 Gateway Timeout 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 504 Gateway Timeout in CloudPanel (/Thread-guide-fix-504-gateway-timeout-in-cloudpanel) |
Fix 504 Gateway Timeout in CloudPanel - DEV - 10-16-2026 A CloudPanel 504 Gateway Timeout means a gateway waited too long for the next server in the request chain. Identify which hop timed out and why before increasing a timeout or adding PHP workers. This CloudPanel v2 diagnostic walkthrough is based on the official documentation. The branded image is a workflow illustration, not evidence of a newly induced outage. Paths, service names and timeout values below must be matched to your installation. AdminsForum troubleshooting workflow: locate the timeout, explain the delay, then verify recovery. 1. Capture the slow request Record the exact URL, HTTP status, time with timezone and approximate time spent waiting. Note recent changes, whether all sites fail, and whether only one operation such as search or report generation is affected. Repeat a harmless public request once. Do not repeatedly submit payments, imports or account changes: the backend may continue after the browser receives an error. Open Sites → affected site → Logs and click Update after the request. Compare Nginx access/error entries with the PHP or app log at that time. Our CloudPanel logs guide explains the viewer and SSH alternatives. If a CDN or Varnish is involved, trace the actual chain. A timeout at the outer gateway does not establish that PHP itself timed out. If the origin shows no matching request, investigate the preceding hop, routing and logging before changing PHP settings. 2. Distinguish connection time from response time Use the wording in the Nginx error log:
3. Measure a harmless URL On an SSH terminal, replace example.com and the path with your site and a safe GET route: Code: curl --max-time 30 -sS -o /dev/null -w 'status=%{http_code} connect=%{time_connect}s first_byte=%{time_starttransfer}s total=%{time_total}s' https://example.com/A cached homepage may be fast while an uncached route fails. Test the affected route and compare equivalent requests, including authentication state, without sharing tokens. Do not disable TLS verification to make the test pass. 4. Check PHP-FPM workers and application work In site Settings, confirm the selected PHP version. SSH's php -v may show another version. Find service names: Code: systemctl list-units --type=service --all | grep -Ei 'php.*fpm'Code: sudo journalctl -u php8.3-fpm.service --since '30 minutes ago' --no-pager -n 100Check the application's own log for slow imports, plugins, loops or failed dependencies. PHP-FPM supports request_slowlog_timeout and a slowlog destination for tracing slow requests. Enabling that is an administrator task: choose a private writable path and a measured threshold, back up the pool configuration, test it with the matching FPM binary, and apply during a suitable window. Restore temporary diagnostic settings after collecting evidence. Slow logs can contain sensitive application details. 5. Check database waits and external dependencies Using an authorized database administration session, a read-only snapshot can help: Code: SHOW FULL PROCESSLIST;For remote APIs, check the app's outbound connect/read timeouts, retry count and dependency health. A request that retries several slow API calls can exceed the gateway budget. Move lengthy exports or batch work into a queue/background job where practical; keep the web request responsible for starting or checking the job. 6. Check server pressure Take a short snapshot rather than changing limits immediately: Code: uptime
free -h
vmstat 1 5
df -h
df -iFor Node.js/Python sites, inspect the existing process manager and application logs as the site user. Confirm the configured App Port matches the actual HTTP app listener. Do not send HTTP probes to PHP-FPM's FastCGI listener. 7. Change a timeout only after identifying its layer
8. Verify recovery Repeat the same harmless route, confirm expected content and status, compare latency and check fresh logs. Test an uncached dynamic route as well as a normal page. Old timeout lines do not disappear when fixed, so use timestamps. If the change does not improve the measured symptom, restore it and continue diagnosis. For support, provide the site type, OS/CloudPanel/PHP versions, status, elapsed time, exact redacted timeout fragment, failing hop and recent changes. Keep credentials, private query data and tokens out of public logs. References Nginx proxy read timeout Nginx FastCGI read timeout PHP-FPM slow log and request limits CloudPanel site settings |