502 Bad Gateway Error
Visitors see "502 Bad Gateway" instead of your site — one server asked another server for your page and got a bad answer back.
Common signs of this issue
- The page shows "502 Bad Gateway," sometimes with "nginx" or "cloudflare" underneath.
- It comes and goes — the site works, then throws 502s for a minute, then works again.
- It started during a traffic spike, a backup job, or right after a plugin or PHP change.
- The admin area may 502 while the public site still loads (or the other way around).
- Slow pages that eventually time out into a 502 rather than loading.
Safe checks you can do yourself
None of these require sharing passwords with anyone.
- Refresh once after 30–60 seconds. A one-off 502 during a server restart is common and harmless.
- Check whether it's just you: search for a free "is it down for everyone or just me" checker and enter your address.
- Note the small print on the error page. "nginx" points at your hosting server; "cloudflare" with an error code points at the connection between Cloudflare and your host.
- Check your host's status page (search "[your host] status") — a shared-server problem shows up there and needs no action from you.
- Think about timing: does it happen at the same time daily (a scheduled backup or cron job overloading the server) or under load (an underpowered plan)?
- If you recently changed PHP versions or added a heavy plugin, note that — a crashing PHP process is one of the most common 502 causes on shared hosting.
- Log into your hosting panel (not the website) and look for resource-usage warnings — CPU, memory, or "entry processes" at 100% will cause exactly this.
What this usually means
Modern hosting is a relay: a front server (often nginx or Cloudflare) passes requests to the machine actually running your site. A 502 means the front server asked and got a broken answer — usually because the back server crashed, ran out of memory, or took too long.
On shared hosting the usual culprits are a PHP process that died (plugin bug, wrong PHP version, memory limit) or a plan that's simply out of resources. Intermittent 502s under load almost always mean the second one.
If your error page mentions Cloudflare, the problem sits between Cloudflare and your hosting server — the host's server may be down or refusing Cloudflare's connections. Your host can see which from their side.
What not to do
- Don't repeatedly hammer refresh during an outage — it adds load to a server that's already struggling.
- Don't start deleting plugins mid-outage without a backup; wait until the site is stable, then test changes one at a time.
- Don't switch nameservers or DNS settings to 'route around' a 502 — DNS isn't the problem, and changes there take hours to undo.
- Don't assume it fixed itself if it goes away — intermittent 502s return, usually at your busiest moment.
When to get help
A persistent or recurring 502 is fundamentally a server-side problem, and your hosting company can see logs you can't. Open a ticket and say exactly when it happens and what the error page says — that's half the diagnosis. If the host says "everything looks fine" but the errors keep coming, that's the point where an independent review (or a better hosting plan) pays for itself.
Could your hosting be the problem?
If your host is slow, unreliable, or hard to deal with, moving to a better one can clear up issues like this for good. One we genuinely recommend is Instant Access Internet Services — a smaller, compassionate company with 30 years in the business, known for being one of the fastest, with great management and low pricing. (Just a recommendation — no affiliate link, no kickback.)
Not sure what to do next?
Answer a few short questions and we'll point you to the safest next step — DIY, a freelancer, or a direct review. No passwords required.
Is this a business website? If this issue may be costing you leads, sales, or trust, you may want a direct review instead of trial and error.
Frequently asked questions
Is a 502 error my fault or my host's?
Usually the host's side of the fence — a crashed or overloaded server process. But a plugin bug or a wrong PHP version on your site can be what's crashing it, so the honest answer is: the host's logs will say.
How long do 502 errors last?
A restart-related blip lasts seconds. Resource exhaustion lasts as long as the load does, and returns. If 502s recur daily, something needs fixing — they won't age away.
What's the difference between 502 and 503?
A 503 means "temporarily unavailable, try again soon" — often maintenance. A 502 means a server upstream gave a broken response — usually a crash or overload.
Do 502 errors hurt my Google rankings?
A brief one, no. If Google's crawler keeps meeting 502s over days, it will slow crawling and can drop pages from the index — one more reason not to let them linger.
Can I fix a 502 by clearing my cache?
No — it's a server-side error. The only visitor-side fix is waiting. Everything else happens on the hosting end.