Knowledge Base

How to Fix a 502 Bad Gateway Error

This article will show you how to fix a 502 Bad Gateway error.

A 502 means one server asked another for your page and got an answer it could not use. On a typical hosting setup that is the web server asking PHP, so the fault is usually behind the site rather than in it.


1. Wait and Reload

Many 502s are momentary, caused by a restart or a brief overload. Reload after a minute before investigating further.

2. Check Whether the Site Is Down for Everyone

Use a third-party checker, or try the site on mobile data. If it loads elsewhere, the problem is your own network or DNS rather than the server.

3. Look for a Script That Runs Too Long

Imports, backups and report generation can outlast the gateway timeout, which returns a 502 even though the script is still running. Run long jobs from the command line or a cron job instead.

4. Check Your Resource Usage

Hitting a memory or process limit causes PHP to stop responding, and the web server returns a 502. Your control panel's resource usage page will show whether you are at the limit.

5. Review Recent Changes

A new plugin, a PHP version change or an edited configuration file are the usual triggers. Undo the most recent change and test.

6. Contact Support if It Persists

If the error continues and nothing on your side explains it, the cause is usually at server level. Open a ticket with the time the error occurred, which lets us match it against the server logs.


Next: How to Check Windows Server Resource Usage in Task Manager covers checking resource usage on a Windows server.

Please rate this article to help us improve our Knowledge Base.

0 0