Skip to main content

What Does HTTP Error 504 (Gateway Timeout) Mean at Seravo

Learn what causes HTTP 504 Gateway Timeout errors in Seravo's hosting environment, how to diagnose the timeout using PHP and nginx logs, and how to resolve slow requests.

HTTP 504 Gateway Timeout means that the web server (nginx) was waiting for a response from a background PHP process, but PHP did not return any output within the timeout window, causing the connection to close.

Note: Error code 504 can stem from different proxy or firewall configurations depending on the hosting platform. This guide describes how the error behaves specifically in Seravo's server environment—generic advice found online (such as modifying max_execution_time in php.ini) does not resolve timeouts in Seravo's stack on its own.

What Causes a 504 Error?

When a browser requests a page that is not served from the HTTP cache (MISS or BYPASS), nginx forwards the request to a PHP-FPM process. If PHP execution takes several minutes without sending any output, nginx stops waiting and returns an HTTP 504 Gateway Timeout error to the browser.

Even though the browser receives a 504 error page, the background PHP process may continue executing until completion.

Prerequisites for Troubleshooting

  • Inspecting logs and running diagnostic tools: Requires a working SSH connection to the server (some logs can also be viewed in the WordPress dashboard under Tools → Logs).

Step-by-Step Troubleshooting

1. Check the nginx and PHP Error Logs

First, identify the exact URL or script that triggered the timeout:

  1. Connect to the server via SSH and inspect the log files in /data/log/ (for more details, see Site Log Files):

    • /data/log/nginx-error.log: Look for upstream timed out entries—the log line displays the exact request URL (request: "GET /..." or "POST /wp-admin/admin-ajax.php") that stalled.

    • /data/log/php-error.log: Check if PHP logged any Fatal error or Warning messages at the same timestamp.

2. Inspect Running PHP Processes

You can check via SSH whether any PHP processes are currently stuck or consuming 100% CPU:

ps aux | grep php

3. Pinpoint Bottlenecks with Tideways Profiling

If a page loads slowly or times out repeatedly without a clear error log entry, use the Tideways profiler to see which plugin, theme function, or external HTTP request is consuming execution time. See Performance Profiling: Tideways.

Common Causes and Solutions

  • Unresponsive external API or HTTP call: A WordPress plugin or theme makes a request to an external service (such as a payment gateway, inventory API, or feed) that fails to respond. Configure a short timeout (e.g., 'timeout' => 5 seconds) on external wp_remote_get() and wp_remote_post() calls instead of relying on defaults.

  • Heavy database queries: Code attempts to fetch thousands of rows at once (e.g., posts_per_page => -1) or runs an unoptimized search query on a large WooCommerce database. Break queries into smaller batches (pagination) or cache results using WordPress Transients / Redis.

  • Long-running admin tasks in the browser (e.g., product imports or backups): Browser-based HTTP requests are not suitable for batch jobs that take several minutes. Run heavy imports, exports, and database updates over SSH using WP-CLI commands inside a screen session (see How to Use the Screen Command for Long SSH Tasks).

  • All PHP workers are occupied (traffic spikes or bot traffic): If the HTTP cache is bypassed extensively and concurrent requests saturate all available PHP workers, incoming requests queue up and time out. Verify your caching setup in How Caching Works at Seravo.

Need developer assistance? If pinpointing the root cause of a 504 error requires deeper code-level investigation, Seravo's specialists can help analyze your PHP code as a separately billed expert service.

Server-Level Incidents

In rare cases, a 504 error may be caused by a server or network infrastructure incident affecting PHP execution or database connectivity. Ongoing incidents and scheduled maintenance are reported in real time on the Seravo Status Page.

See Also

An HTTP 504 error is almost always linked to a single slow PHP execution, an unresponsive external API, or saturated PHP workers. If you need assistance identifying the root cause or ordering expert developer support, please contact our customer support team at [email protected].


​

Did this answer your question?