Guides › Hosting, domain & email › Site down or error screens

502 Bad Gateway and 504 Gateway Timeout: What to Do

The server in front of your site got a bad or no answer from the server behind it. Check timeouts, PHP limits and heavy tasks.

Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.

These errors come from servers that pass requests to your PHP application. They mean the application crashed, took too long, or was unreachable.

Step 1: Reload, then test another page

If it happens only on one page or action, the cause is likely a slow script there.

Step 2: Check the error log

Your host's error log names slow or crashing scripts. See our PHP error guide.

Step 3: Look at limits

Long imports, backups or reports can exceed the maximum execution time. Raise max_execution_time and the memory limit in your host's PHP settings. See our memory guide.

Step 4: Check plugins

A plugin that calls a slow outside service can cause timeouts. Disable recently added plugins. See our conflict guide.

Step 5: If you use a CDN or proxy

Test with the CDN paused. For Cloudflare, see our Cloudflare errors guide.

Step 6: Server load

If errors come in waves, the server may be overloaded. See our 503 guide and ask your host about restarts and limits.

Related guides

Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.

Last updated 2026-11-21.