Skip to content
OSULZER.AT

Is my website down?

Error 502: Bad Gateway

Is the proxy not getting an answer from your server? Check right here whether the 502 persists or was just a blip.

Checks the status code, every redirect, the variants with and without www and over http and https, the SSL certificate and the response time.

Free, no sign-up - no data about you is stored.

Technical finding without guarantee. The check runs once from a server in Germany. If your website is only unreachable from certain networks or countries, the result may differ.

What does Error 502 mean?

A 502 Bad Gateway happens when two servers work together: a server in front, such as nginx, a load balancer or a CDN like Cloudflare, accepts the request and passes it on to the actual server. If it gets no response or an unusable one, the server in front reports 502.

The best-known version is the plain "502 Bad Gateway" page with "nginx" underneath. It doesn't mean nginx is broken, but that nginx can't reach PHP or the application server behind it. The fault is always on the server side.

Common causes.

  • PHP-FPM isn't running or has crashed

    nginx hands PHP requests to PHP-FPM. If the service is stopped, has crashed or wasn't restarted after an update, you get a 502.

  • Wrong connection to PHP

    After switching PHP versions, the config still points to the old socket or port where nothing answers anymore.

  • PHP process dies

    A plugin crashes PHP, or the process is killed for using too much memory. The connection drops before a response arrives.

  • Response headers too large

    If the application sets lots of cookies, the headers exceed the proxy buffer. nginx then logs "upstream sent too big header".

  • Server behind the CDN unreachable

    With Cloudflare or a reverse proxy, the actual server is down, overloaded or blocks the proxy with a firewall.

With WordPress and hosting.

With WordPress on nginx and PHP-FPM, a 502 usually comes from PHP: the service didn't start cleanly after a PHP update, a plugin crashes PHP, or all PHP workers are busy and new requests are turned away. With Plesk and similar panels, nginx often runs in front of Apache, and there too 502 means the server behind it isn't answering.

In WooCommerce shops with lots of cookies, the 502 sometimes only shows up on certain actions, like the cart or login, because the response headers get too large. With Cloudflare, an error page in Cloudflare's design shows whether the 502 comes from Cloudflare or from your own server. If it points to your server, the problem lies with your hosting.

How to fix it.

  1. Reload after a moment

    A single 502 after a restart or update often disappears within seconds. Run the checker above a few times to see whether it sticks.

  2. Restart PHP

    Many hosting panels let you restart PHP or PHP-FPM, or simply re-save the PHP version. On your own server, restart the service.

  3. Read the web server's error log

    The nginx or proxy log names the exact reason, such as "connection refused", "no such file" for the socket, or "upstream sent too big header".

  4. Check plugins

    If the error only appears on certain pages, deactivate plugins one by one. A crashing plugin also shows up in the PHP error log.

  5. Adjust buffers and workers

    For oversized headers or too few PHP workers, the server configuration needs adjusting. On shared hosting, your host takes care of that.

  6. With Cloudflare, test the server directly

    If the server is reachable without Cloudflare, the problem is the connection in between, such as a firewall blocking Cloudflare's IP ranges.

Impact on Google.

For Google, a 502 is a server error like 500 or 503. Short outages only slow down crawling. If the errors last several days, pages disappear from the index and only gradually return after the fix.

Frequent short 502s, for example at peak times, are a sign the server is running at its limit. Then it's worth looking at your hosting plan or moving to managed WordPress hosting with enough PHP workers.

Good to know

Questions about Error 502?

The most common questions, answered briefly.

Questions about Error 502

What does "502 Bad Gateway nginx" mean?

nginx accepted the request but didn't get a usable response from PHP or the server behind it. The fault is usually PHP, not nginx itself.

What's the difference between 502 and 504?

With 502 the server behind sends a broken response or none at all, the connection fails. With 504 the connection works, but the response takes too long.

Is a 502 caused by my internet connection?

No. If you can see the error page, your internet worked. The problem is between the servers of the website.

All status codes at a glance.

2xx: Success

  • 200OKAll good: the server understood the request and delivers the page.
  • 201CreatedThe request succeeded and created something new, for example a record via an API.
  • 204No ContentSuccessful, but the response has no body. Typical for APIs and background requests, not for regular pages.

3xx: Redirects

5xx: Server errors

No status code: connection errors

New project?

Contact.

Tell me briefly about your project - I'll get back to you personally.

Your data is used solely to handle your inquiry. More in the privacy policy.