Knowledgebase article

"504 Gateway Timeout": what it means and how to fix it

A 504 Gateway Timeout means the server waited for your website's code to answer, and gave up because it took too long. The page didn't fail; it just didn't finish in time.

Common causes

  • a long-running script, such as an import, export, backup or report
  • a slow database query
  • a plugin calling an external service that's slow or down
  • Cloudflare or another proxy timing out while waiting for the server

What to do

  1. Reload once. If it was a one-off, it may work now.
  2. Think about what you were doing. Big imports or bulk edits are the usual suspects. Split them into smaller parts.
  3. Check the error logs in cPanel > Metrics > Errors to see which script was running.
  4. Disable the plugin you suspect (rename its folder in wp-content/plugins) and test again.
  5. Raise PHP's time limit, if your script legitimately needs longer: Software > Select PHP Version > Options, then increase max_execution_time.
  6. Using Cloudflare? Cloudflare times out after about 100 seconds. Run long tasks with a cron job instead of through the browser.

Server owners

For PHP-FPM and Apache timeout settings in WHM, see PHP-FPM (70007) The timeout specified has expired: Error.

Still timing out? Open a ticket with the page address and what you were doing, and Romeo will dig in.

Was this answer helpful?

Related articles

Still stuck? Romeo's got you.
Our support team replies around the clock, real humans who know your server.