+44 7575 472931[email protected]
HostAccentKnowledge BaseHosting, websites, SEO, and growth

Fix 504 Gateway Timeout WordPress Error: 2026 Guide

Seeing a 504 gateway timeout in WordPress? Learn what causes it, how to fix the timeout fast, and when slow hosting is the real problem to solve for good.

WordPressSpeed & PerformanceVPS Hosting
Diagram of how a 504 gateway timeout WordPress error happens between the proxy and PHP, with fix steps for site owners in 2026

Your site worked an hour ago. Now visitors hit a near-blank page that just says 504 Gateway Timeout — and hammering refresh only makes it worse. If you're staring at a 504 gateway timeout WordPress error right now, take a breath. It's almost always fixable, and it's rarely your writing or your theme's fault.

A 504 means one server waited on another and ran out of patience. Usually your web server (acting as a proxy) asked PHP to build the page, PHP took too long, and the proxy gave up.

Quick Answer: A 504 gateway timeout WordPress error appears when your server's proxy layer — often Nginx or a CDN — doesn't get a reply from PHP in time. Fix it by raising the PHP and proxy timeout values, hunting down the slow plugin or database query causing the delay, adding caching, and, if the 504s keep returning under traffic, moving to a plan with dedicated CPU and RAM.

What a 504 Gateway Timeout Actually Means

Think of your hosting stack as a relay. A request comes in, hits a front-end server (the gateway or proxy), and that server hands the work to an upstream process — PHP — that builds the actual page. The gateway waits a fixed number of seconds for a reply. If the reply never lands in time, the gateway stops waiting and returns a 504.

So a 504 is never really "the website is broken." It's "the front server asked the back server for a page, and the back server was too slow to answer." The official MDN HTTP 504 status reference describes it the same way — a gateway that didn't get a timely response from an upstream.

A few cousins confuse people:

  • 502 Bad Gateway — the upstream replied, but with garbage (often PHP crashed).
  • 524 (Cloudflare) — Cloudflare's own timeout when your origin takes longer than its limit. People read it as a 504, but it comes from a different layer.
  • 503 — the server is up but refusing work, often during overload or maintenance.

Knowing which one you have tells you where to look. A true 504 points you at the gap between the proxy and PHP.

Pro Tip: Before changing anything, open your browser's Network tab and check whether the 504 is served by your origin or by a CDN edge. The response headers (look for server: and cf-ray:) tell you which machine timed out. Fixing the wrong layer wastes an afternoon.

What Causes the 504 Gateway Timeout WordPress Error (Ranked)

In real troubleshooting, the same handful of causes show up over and over. Ranked roughly by how often they're the culprit:

  1. PHP or proxy timeout set too low. Your script genuinely needs 45 seconds, but the proxy is told to wait 30. Nothing's "broken" — the limit is just too tight. PHP's own ceiling is max_execution_time; the proxy has its own, separate limit.
  2. A slow plugin or unindexed database query. One bloated query, a heavy related-posts widget, or an autoloaded options table can drag a single page load past the limit.
  3. An overloaded server. When CPU and RAM are maxed, every request queues. PHP workers pile up, and pages that normally take 2 seconds take 60. This is the cause that gets worse with traffic, not better.
  4. A proxy or CDN timeout. If you run Nginx in front of Apache, Nginx's fastcgi_read_timeout and proxy_read_timeout directives decide how long it waits. Defaults are often 60 seconds.
  5. A hanging external call or wp-cron job. A plugin pinging a dead API with no timeout, or wp-cron.php running a heavy task on a busy page load, can stall PHP until the gateway quits.

Notice the pattern. Causes 1 and 4 are configuration. Cause 2 is code. Cause 3 is resources. The fix is completely different for each, which is why guessing rarely works.

How to Fix a 504 Gateway Timeout WordPress Error, Step by Step

Work top to bottom. Stop when the error clears.

Step 1 — Read the logs first. Your PHP-FPM and web server error logs name the upstream that timed out. An Nginx line like upstream timed out (110: Connection timed out) confirms a proxy-to-PHP gap. Don't skip this — the log usually points straight at the slow thing.

Step 2 — Raise the timeouts (a stopgap, not a cure). Give the page room to finish while you find the root cause:

  • PHP: set max_execution_time = 300 in php.ini (or via your control panel's PHP settings).
  • PHP-FPM: bump request_terminate_timeout to match.
  • Nginx: raise fastcgi_read_timeout and proxy_read_timeout to 300s, then reload.
  • Apache (if in the chain): raise the Timeout directive.

This buys breathing room. It does not fix a genuinely slow page — it just hides the symptom for longer.

Step 3 — Find the slow thing. Install Query Monitor and load the page that throws the 504. It flags slow queries, slow hooks, and the plugin responsible. No obvious offender? Deactivate plugins in batches and retest — the classic "disable half, narrow down" hunt. Also check whether wp-cron is running heavy jobs on front-end requests; moving it to a real system cron removes a common stall. Our WordPress Site Slow: Complete Diagnosis and Fix Guide (2026) walks the full diagnostic path if the cause is hiding.

Step 4 — Cache aggressively. Every request PHP doesn't have to build is a request that can't time out. Add full-page caching, and an object cache (Redis) for the database layer. Caching is also the cheapest win for TTFB — see How to Fix High TTFB in WordPress: Step-by-Step Guide for 2026 and the broader web.dev performance guidance for what "fast enough" looks like in 2026.

Step 5 — Check server load under real traffic. Watch htop or your panel's resource graphs while the site is busy. On a typical Hostaccent stack the proxy is Nginx and the upstream is Apache with PHP-FPM, so we look at PHP worker saturation and CPU steal first. If the box is pinned at 100% every afternoon, no timeout setting will save you — that's the next section.

Insider Insight: A gateway timeout fix that only raises limits is a trap. If a page needs 120 seconds to load, your visitors already left. Treat raised timeouts as a temporary bandage while you cut the page back under 2–3 seconds with caching and a query fix.

When the 504 Is a Hosting Problem, Not a Code Problem

Here's the honest dividing line. If a 504 shows up once, during a backup or a cron spike, it's usually a one-off. If a 504 timeout website failure shows up every time traffic climbs — payday for an eCommerce store, a newsletter send, a product launch — that's not a bug. That's your plan running out of room.

Shared hosting throttles. You share CPU, RAM, and a capped number of PHP workers with hundreds of other accounts. When your traffic and theirs peak together, your requests queue behind everyone else's, and the proxy starts handing out 504s. You can cache and optimize perfectly and still hit the ceiling, because the ceiling isn't yours to raise.

What changes on a properly resourced VPS or cloud plan:

  • Dedicated CPU and RAM — your PHP workers aren't fighting noisy neighbours for cycles.
  • More concurrent PHP-FPM children — more requests served in parallel before anything queues.
  • NVMe storage — slow queries finish faster simply because disk reads are quicker.
  • Headroom for spikes — load doubles and you still have margin instead of a wall.

When we move a stuck site onto a Hostaccent VPS, the recurring-under-load 504s almost always vanish on the first busy day, because the queue that was forming now has somewhere to go. That's also why repeated 504s correlate so tightly with failing performance scores — see Core Web Vitals Failing? Your Hosting Might Be the Problem. If you've optimized and still hit the wall, our Best VPS for WordPress in 2026: Tested and Ranked for Real Performance and Best Hosting for High Traffic WordPress Sites in 2026 breakdowns show what a no-throttle plan actually buys you.

Pro Tip: Want proof before you migrate? Run a load test (even a simple one) and watch when the first 504 appears. If it lands well below your real traffic peak, the plan — not the code — is the bottleneck.

The Fastest Way to Stop 504s for Good

The short version, so you can act today:

  • A 504 is a timeout between the proxy and PHP — not a broken site.
  • Raise timeouts to stop the bleeding, then find the slow plugin or query that caused it.
  • Cache everything so PHP does less work per request.
  • If 504s return under load, the fix is resources, not config.

If you've raised every timeout, cached everything, and the 504s still appear the moment traffic climbs, the math is simple: your plan ran out of headroom. We build Hostaccent VPS plans on a Cloudflare → Nginx → Apache stack with NVMe storage and dedicated CPU and RAM, so PHP isn't queueing behind strangers. Our Professional Linux VPS runs $22.00/mo and gives most growing sites the room to answer fast. If a recurring 504 gateway timeout WordPress error is costing you visitors, see the Linux VPS plans and match the tier to your traffic.

Frequently Asked Questions

How long before a 504 gateway timeout WordPress error appears?

It depends on the lowest timeout in your chain. Most proxies and PHP setups default to 30–60 seconds. The first limit reached wins — so if Nginx waits 60 seconds but PHP quits at 30, you'll see the 504 at the 30-second mark, not 60.

Is a 504 error WordPress problem caused by my plugins?

Often, yes. A single slow plugin — heavy related-posts queries, an unbounded external API call, or a bloated page builder — can push one page past the timeout. Use Query Monitor to spot the offender, then deactivate plugins in batches to confirm which one is responsible.

How do I fix a 504 gateway timeout WordPress error without a developer?

Start non-technical: clear your cache, deactivate recently added plugins, and switch to a default theme to test. If that helps, you've found the cause. If the error returns under traffic no matter what you disable, it's a hosting resource limit, and the real gateway timeout fix is a bigger plan — not more tinkering.

What's the difference between a 504 and a 524 error?

A 504 comes from a server in your own stack (usually Nginx waiting on PHP). A 524 is specific to Cloudflare and means your origin took longer than Cloudflare's edge limit to respond. Both signal "too slow," but they point at different layers, so check the response headers to see which one fired.

Will more RAM fix nginx 504 errors?

Sometimes. If your nginx 504 is caused by PHP workers stalling under memory pressure, more RAM (and more concurrent PHP-FPM children) genuinely helps. But if the 504 comes from one slow query timing out, RAM won't touch it — you need to fix or cache that query. Diagnose the cause before buying resources.

Does Cloudflare cause 504 timeout website issues?

Cloudflare itself rarely causes them — it usually surfaces a slow origin. If your server answers quickly, Cloudflare passes the page through fine. If your origin is overloaded, you'll see a 504 or 524 regardless. The lasting cure for a 504 gateway timeout WordPress error is a faster, better-resourced origin, with Cloudflare simply forwarding the quicker response.

Reviewed by

Lena Fischer · WordPress & Performance Specialist

Last updated

Jun 14, 2026

L
Lena FischerWordPress & Performance Specialist

Lena focuses on WordPress optimisation, Core Web Vitals, and site speed engineering. She helps agencies and e-commerce brands consistently reach sub-two-second load times.

Discussion

Have a question or tip about this topic? Share it below — your comment will appear after review.

Your email stays private and is only used for moderation.

How long before a 504 gateway timeout WordPress error appears?

It depends on the lowest timeout in your chain. Most proxies and PHP setups default to 30–60 seconds. The first limit reached wins — so if Nginx waits 60 seconds but PHP quits at 30, you'll see the 504 at the 30-second mark, not 60.

Is a 504 error WordPress problem caused by my plugins?

Often, yes. A single slow plugin — heavy related-posts queries, an unbounded external API call, or a bloated page builder — can push one page past the timeout. Use Query Monitor to spot the offender, then deactivate plugins in batches to confirm which one is responsible.

How do I fix a 504 gateway timeout WordPress error without a developer?

Start non-technical: clear your cache, deactivate recently added plugins, and switch to a default theme to test. If that helps, you've found the cause. If the error returns under traffic no matter what you disable, it's a hosting resource limit, and the real gateway timeout fix is a bigger plan — not more tinkering.

What's the difference between a 504 and a 524 error?

A 504 comes from a server in your own stack (usually Nginx waiting on PHP). A 524 is specific to Cloudflare and means your origin took longer than Cloudflare's edge limit to respond. Both signal "too slow," but they point at different layers, so check the response headers to see which one fired.

Will more RAM fix nginx 504 errors?

Sometimes. If your nginx 504 is caused by PHP workers stalling under memory pressure, more RAM (and more concurrent PHP-FPM children) genuinely helps. But if the 504 comes from one slow query timing out, RAM won't touch it — you need to fix or cache that query. Diagnose the cause before buying resources.

Does Cloudflare cause 504 timeout website issues?

Cloudflare itself rarely causes them — it usually surfaces a slow origin. If your server answers quickly, Cloudflare passes the page through fine. If your origin is overloaded, you'll see a 504 or 524 regardless. The lasting cure for a 504 gateway timeout WordPress error is a faster, better-resourced origin, with Cloudflare simply forwarding the quicker response.

Write for the Community

Have a tutorial, tip, or insight to share? Get published on the HostAccent Blog with your name, bio, and website link.

Become a Contributor

Need a faster setup for this workflow?