fbpx

How to Fix the 504 Gateway Timeout Error in WordPress

The internet is a very large and complicated place, no matter how you may wish, in a place as complex as the internet you will always run into errors. One of the errors you will run into is the 504 gateway timeout error, a common HTTP error experienced by website owners and visitors.

It is very hard to pinpoint the cause of the 504 gateway timeout error, and the error if not fixed will keep appearing on your site preventing visitors from accessing your WordPress website. In this article, I will explain everything about the error and how to fix the 504 gateway timeout error in WordPress.

What is the 504 Gateway Timeout Error?

The 504 Gateway Timeout Error occurs when a server you are trying to connect with doesn’t respond on time.

When a visitor sends a request for a particular webpage, the site’s DNS contacts the hosting server for the requested page. If there’s an issue resulting in the server taking too long to respond, this will result in you getting the 504 error message.

504 gateway timeout

Cause of the 504 Gateway Timeout Error

The 504 error occurs when a web server exceeds its response time. There are several reasons for the error, and the reason goes from the bad network connection to incompatible plugins.

Below are some of the common causes of the 504 gateway timeout error.

  • Slow server response
  • Firewalls blocks
  • An issue with the site’s DNS
  • Bad network connection
  • An issue with the web browser
  • Inability to connect to a proxy server

How to Fix the 504 Gateway Timeout Error in WordPress

Reload the Webpage and Wait for a Response

If you are attempting to reach a webpage and you encounter the 504 gateway timeout error, wait a few minutes then reload the webpage. This way you will check if this error warning was just a temporary glitch caused by the hosting server.

If you are using a Windows PC, you can easily reload the webpage with a shortcut, F5, on your keyboard. Or you can click on the reload icon located at the left of the search bar.

If the issue persists after this, you can proceed to the next troubleshooting listed here.

Turn off Your VPN

If you are connecting with the site through a VPN service, this may be the reason why you are experiencing issues with connecting to the web server.

Sometimes your VPN server may be having issues connecting to the web server, resulting in you getting the 504 gateway timeout error. In this case, you have to turn off the VPN.

If you are able to connect with the site after disabling the VPN, then the problem was probably caused by the faulty VPN. You can either contact your VPN service provider for assistance or switch to another VPN service if the VPN was really that important to you.

Restart your Device’s Network

Sometimes a bad network connection may be the reason you’re unable to connect to your server, triggering the 504 error. 

Check your network device, your modem, or Wi-Fi router, and disconnect and reconnect them again to your device. This way you will be able to figure out if there was an issue with your network connectivity.

If you are unable to fix this bad network after reconnection, you can contact your network provider for assistance.

Disable Website’s Firewall 

Firewalls play an important role in the protection of our website from attacks from malware, hackers, and bots. But if your website’s firewall is too strict or badly configured, this may result in you having to deal with the 504 error.

In this case, you should temporarily disable any firewall you have on your site that may be blocking you from connecting with your hosting server. 

If the error clears after disabling the firewall, then the issue was likely due to the firewall IP address being blocked by your hosting server. Report the issue to your firewall provider, request their list of IP addresses then submit it to your hosting provider to sort it out.

Clean Your WordPress Database

One reason you may be experiencing this issue may be due to a cluttered database. If your WordPress database is cluttered with corrupt files, this may trigger the 504 gateway timeout error. The database mostly contains a revision of every post you created, so you should ensure to clean it up at least once in a while.

You can clean it up using a plugin or through your phpMyAdmin. Ensure your WordPress database is backed up before performing this exercise.

Issues with DNS servers

Your DNS servers may be having issues connecting your computer to various servers. These issues may be the reason for the 504 error message. This issue may be from your own servers or from your hosting servers.

You can sort this out you will have to switch your device’s DNS server.

If you are using Windows, go to Control Panel > Network and Sharing Center to perform the change.

If you are using Mac, go to Settings > Network, then select Advanced to find the DNS tab.

Now change the DNS server address to 8.8.8.8 and 8.8.4.4, then visit your website to see if the error has been fixed.

Disable all your WordPress Plugins

Temporarily disabling all your WordPress plugins is a good way to figure out if the 504 error is caused by one of your plugins. Since WordPress plugins run on PHP scripts, you will also stop all external PHP scripts.

Since you can’t access your WordPress dashboard because of the 504 error, you will have to connect to your website using an FTP client like FileZilla or your File Manager in CPanel.

Go to FileZilla, open and connect to your website, then go to the public_html directory and navigate to wp-content, there you will find a folder called plugins. This folder contains both the active and inactive plugins on your site, rename the folder to plugin-old. This will automatically deactivate all the plugins on your site.

Now go back to your website and try accessing your WordPress dashboard. If you are able to access the site, then the reason for the 504 gateway timeout error was one of your plugins. Now, you just have to figure out which one is faulty.

Contact Hosting Provider

If after trying all the methods and you are still unable to fix the error, then what you should do is contact your website’s hosting company, report all the steps you have taken and request their assistance in solving the issue.

Leave a Reply