Family Encyclopedia >> Electronics

How to fix 504 Gateway Timeout error in WordPress

Have you ever received a 504 gateway timeout error on your WordPress site? This error can make your website inaccessible to users. The worst part is that it can go away and come back on its own if the underlying problem is not resolved. In this article, we will show you how to fix the 504 gateway timeout error in WordPress.

How to fix 504 Gateway Timeout error in WordPress

What causes the 504 gateway timeout error?

The 504 gateway timeout error typically occurs when a server is unable to connect to an upstream server to complete a request.

For example, if you're using a website firewall like Sucuri, and you can't connect to your WordPress server, you'll see a 504 gateway timeout error.

The appearance of the error page and message may be displayed differently depending on the WordPress hosting company, proxy server, or browser you are using. Here are some of the more common 504 gateway timeout error messages.

  • 504 gateway timeout
  • HTTP 504
  • 504 ERROR
  • Gateway timeout (504)
  • HTTP Error 504 - Gateway Timeout
  • Gateway timeout error

How to fix 504 Gateway Timeout error in WordPress

While the most common reason for the error is that a proxy server cannot reach the upstream server, it can also be triggered by other server configuration issues.

With that being said, let’s see how to easily fix the 504 gateway timeout error in WordPress.

1. Please wait and reload

Sometimes the 504 gateway timeout error can simply be caused by a temporary error on the WordPress hosting servers. Give it a few minutes and then try to reload your website.

If the problem goes away, you do not need to take any further steps. However, if the error persists or reappears after some time, continue reading to troubleshoot and fix the problem.

2. Turn off the VPN

How to fix 504 Gateway Timeout error in WordPress

If you are using a VPN service to browse the web, try disabling it. Sometimes your VPN server may not be able to get a response from your managed WordPress hosting server, and this will result in a 504 gateway timeout error.

If your website reappears, this means that the VPN server was the culprit. Now if VPN usage is important to you, then you can try switching to a different VPN server. If you are seeing the error even after changing servers then you should contact your VPN service provider for support.

3. Disable website firewall

If you are using a DNS level website firewall like Sucuri or Cloudflare, try temporarily disabling the firewall. This will allow you to connect to your WordPress hosting server directly.

How to fix 504 Gateway Timeout error in WordPress

If that fixes the problem, then it is likely that your hosting server is blocking firewall IP addresses which can cause this problem. You will need to contact your firewall service provider to get their list of IP addresses and then contact your web host to whitelist those IPs.

Sometimes turning off the firewall can show you the actual error notice from the server. In that case, you should check out our list of common WordPress errors to fix the specific problem.

4. Disable your network proxy

If you are connected to the Internet through a proxy server, that server may not be able to get a response from your WordPress website.

Try accessing your website using a different internet connection or use online services to see if your website is down just for you or for everyone.

If it is down just for you, then you need to change your network settings. You can contact your Internet service provider or a network administrator to fix the problem for you.

5. Change your DNS servers

Your internet connection uses something called DNS servers. These servers help your computer to connect to the different servers on the Internet.

If the DNS servers you are using are down or unable to connect to your website, you could see a 504 gateway timeout error. The easiest way to check this is to change the DNS servers your device uses.

On Windows computers, you can find them in Control Panel »Network and Sharing Center screen.

How to fix 504 Gateway Timeout error in WordPress

On Mac computers, you can find them in Settings »Network . Click the Advanced button and then select the DNS tab.

How to fix 504 Gateway Timeout error in WordPress

You can change your DNS server address to 8.8.8.8 and 8.8.4.4 and apply changes.

Try to visit your website now. If this resolved your error, then you are all done. The problem was with your internet connection, and now it's fixed.

6. Clean your WordPress database

A damaged WordPress database can also trigger a 504 gateway timeout error. Don't worry, your WordPress data is most likely safe. However, your database may need some spring cleaning.

This can be easily done by optimizing your WordPress database using phpMyAdmin or by using a plugin like WP-Sweep. Make sure to backup your WordPress database before taking any action.

7. Deactivate WordPress plugins and switch to default theme

WordPress plugins and themes are less likely to cause a 504 gateway timeout error. However, if a plugin or theme is making too many requests to the server, it is likely that some of these requests will be dropped and trigger a 504 gateway timeout error.

To test this, you need to disable all WordPress plugins via FTP.

How to fix 504 Gateway Timeout error in WordPress

After that, visit your website to see if the error has been resolved.

If so, then one of your plugins was causing the problem. Now you need to activate all the plugins one by one until you can reproduce the error. This will help you locate the plugin responsible for the error.

If disabling plugins did not fix your problem, then you should check your WordPress theme. You will need to change the WordPress theme through phpMyAdmin.

After changing your theme to the default WordPress theme, visit your website to see if it's working.

8. More troubleshooting

If all else fails, and you still can't resolve the 504 gateway timeout error, follow the steps in our WordPress troubleshooting guide for beginners.

Finally, as a last resort, you should contact your hosting provider for assistance. They may be able to fix the problem or point you in the right direction.

We hope this article helped you learn how to fix 504 gateway timeout error in WordPress. You can also check out our guide on how to protect WordPress against brute force attacks.

If you enjoyed this article, please subscribe to our WordPress YouTube Channel video tutorials. You can also find us on Twitter and Facebook.