SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30 SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30 SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30
SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30 SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30 SPECIAL OFFER Get 30% OFF on All Qode Plugins Discount code: WOOCOMMERCE30
BACK TO TOP

How to Fix the “504 Gateway Timeout” Error in WordPress

How to Fix the 504 Gateway Timeout Error in WordPress

A 504 gateway timeout is one of the HTTP status codes. It’s sent by a server in response to being unable to fulfill a request made by a client or web browser. When you visit a web page, it generates requests and sends them to web servers that store the necessary elements. Each time a request is processed, the server sends an HTTP status code with the requested resources. Typically, the HTTP status code isn’t displayed unless something has gone wrong in the process.

Although the 504 gateway timeout WordPress error is not as common as a 500 internal server error or a 502 bad gateway error, anyone browsing the Internet has probably encountered it at least once. For that reason, we’ll take a look at this error and show you the most common ways to solve it in WordPress. To help you with troubleshooting, we’ve broken the article down into several smaller steps:

What is a 504 Gateway Timeout Error?

HTTP status codes beginning with 500 are server-side error-reporting codes. They appear whenever a request can’t be executed due to faulty communication between servers.

There are many different types of 500 status error codes, such as 500, 501, 502, 503, etc. and they all have different meanings. However, all the 500-errors mean that there was a request that was accepted but the server prevented its execution.

The 504 gateway timeout error is an error that occurs when a server does not receive a timely response from another server that acts as a gateway or proxy. Essentially, this means that the server failed to fulfill a client or web browser request within a given time frame.

The 504 gateway timeout error can be differently displayed, depending on the browser you’re using. Here are a few examples:

  • 504 Gateway Timeout
  • 504 Gateway Timeout NGINX
  • HTTP Error 504
  • HTTP Error 504 – Gateway Timeout
  • HTTP 504
  • Gateway Timeout Error
  • Gateway Timeout (504)
  • Error 504
  • 504 Error

How to Resolve the 504 Gateway Timeout Error in WordPress

In most cases, the 504 gateway timeout errors occur on the side of the server hosting the WordPress website. However, they can also appear on the client-side or web browser user-side. Also, they can occur as a result of a third-party plugin. Therefore, in the following section, we will go through the basic steps of resolving this error on both the client- and server-side.

Refresh the Page

The first step in resolving a 504 gateway timeout error is also the easiest. Occasionally, the server receives too many requests at the same time, and, due to the overload, it returns this error. When the error occurs, wait a few minutes and try to refresh the page in the browser (press F5 or Ctrl + F5 for Windows or Command + R for Mac).

While you wait to refresh the page, you can use an online tool to check if the website has crashed. This is a good way to verify if the problem is related to the local network. We suggest using https://downforeveryoneorjustme.com/ since all you have to do is visit the website and then type in the URL of your website to run the test. This tool will check the HTTP status code returned from the server hosting your site. As a result, you will receive information on whether your site has crashed or if the problem lies in the client-side from which you are trying to access the website.

Resolve the 504 Gateway Timeout Error
The site has crashed

If the check receives an HTTP status code other than 200 (“Everything is ok”) you will be notified that the site has crashed.

But, just in case, you can try to open a page from your website in another browser to make sure that the problem isn’t due to the browser you’re using.

Disable Proxy Settings

Sometimes you can get an error 504 if you use a proxy service. This is usually quite rare, especially on the client-side. However, a proxy service may be set up without your knowledge. We’re going to show you how to check if your proxy settings are enabled using the Chrome browser in Windows. The steps you’d use with a Mac closely resemble these.

1. Click on Chrome Menu in the browser’s toolbar

Disable Proxy Settings

2. Select Settings

Select Settings

3. Then click on Advanced

Advanced Options

4. After that, locate the System section and click on Open your computer’s proxy settings

Open proxy settings

5. Under Automatic proxy setup, you need to turn off Automatic detect settings

Turn off Automatic detect settings

6. Under Manual proxy setup, you need to turn on Use a proxy server

Turn on Use a proxy server

7. When you’re done with the changes click on Save

DNS Issue

A 504 gateway timeout error can also result from an incorrect or outdated DNS (Domain Name System) cache. In that case, you can easily clear it. The way you approach this depends on your operating system. We will show you how the steps look in Windows.

First, press Windows key + R on your keyboard and then type in cmd to open the Windows command prompt console.

DNS Issue

Insert the following command to delete the DNS cache files from your computer:

ipconfig /flushdns
Delete the DNS cache files

If successful, you will get a confirmation that the DNS cache has been flushed.

The DNS cache has been flushed

If you’re working on a Mac, you can add this command into the Terminal:

dscacheutil –flushcache

The only difference between the two is that on Mac’s Terminal you won’t receive a message that the process has been completed successfully.

You can also temporarily switch the DNS server to Google Public DNS to rule out the possibility that the HTTP status code with the 504 error appeared because of a DNS issue.

Qode WordPress Themes: Top Picks
Bridge WordPress Theme Banner
Bridge

Creative Multi-Purpose WordPress Theme

Stockholm WordPress Theme
Stockholm

A Genuinely Multi-Concept Theme

Startit WordPress Theme
Startit

Fresh Startup Business Theme

Biagiott banneri
Biagiotti

Beauty and Cosmetics Shop

Test Your Website on Different Devices

In case that none of the solutions above helped to resolve the 504 error, you should try opening your site on a different device. Test your website by loading it on another computer, via another internet connection, or on a mobile phone. This way you will be able to determine for sure if it’s a local or a server-side problem.

Check Error Log

For more details on the error, you can also check the server error log. It can help you narrow down the cause of the problem, particularly if it’s caused by an activated plugin. A 504 gateway timeout error can sometimes occur because of an update or activation of an incompatible plugin.

You can access the error log by logging into your hosting account and using the cPanel interface. In the Metrics section, locate the Errors option. If you have difficulties accessing your hosting account, you should contact your host provider.

cPanel Errors

When you open the Errors option, you will see a detailed view with messages concerning all the errors the server has recorded.

All the errors the server has recorded

If your web hosting control panel differs from ours, or if you’re using a different control panel, you can look for a similar option or check with your host provider whether it is accessible for you.

In case the option to check the server error log via the hosting account is not available, you can enable debug mode. And this will show you more details about the error. Debug mode is enabled by adding or changing this code within the config.php file:

define('WP_DEBUG', true);
Enable debug mode

Once you’ve entered the code into the file and saved it, just reload your website in a browser. Check if you can see more detailed information next to the error, such as the path to the file and the line of code that caused the error. In case the error was caused by the file of a plugin that you activated, you can simply delete it.

Even if the debugging mode doesn’t show you the best results, it’s good practice to leave it enabled until you solve the problem. Then, after fixing the issue, you can turn off debug mode by removing the code that you previously added to your config.php file.

Check Your Plugins and Themes

In the vast majority of cases, this error is caused by one of the plugins or even the theme used for the WordPress website. Frequent plugin updates can adversely affect your site, especially if you enabled automatic updates. They will make it difficult to notice right away that a change occurred after the update.

With 504 and similar errors, it often happens on the server-side that you aren’t able to access the WordPress admin panel and deactivate the plugins there. So, in the following section, we’ll show you how to deactivate plugins via FTP. You can also deactivate plugins by logging in to your hosting account and using the File Manager option in cPanel. The procedure after accessing the files on the server is the same for both.

We’re going to connect to the server via FTP using the FTP client FileZilla. When you access the server, you need to find and rename the plugins folder. It’s located in the wp-content folder within the root folder containing all your WordPress files.

Rename the plugins folder

All you have to do is select the folder, right-click on it, and choose the Rename option. Doing this will deactivate all your plugins. WordPress will search for the plugins folder to load its plugins, but when it’s not able to find them, it will simply deactivate them all.

Search for the plugins folder and deactivate

Now that you’ve deactivated all plugins, check if the error is fixed. In case it’s resolved, you need to re-activate the plugins, one by one. After each activation of an individual plugin, check your website—this will determine which exact plugin led to the error.

Once you’ve found the plugin causing the error, immediately delete it from the WordPress installation. Then you can look for alternative plugins to replace it.

If deactivating the plugins didn’t solve the error, you should investigate your currently active theme. The best way to do that is by replacing it with one of the default WordPress themes. Using the same principle we described for the plugins, you can deactivate your WordPress theme. In case you don’t have any other themes installed, you can download and install a free theme from the WordPress repository, like the Twenty Nineteen.

Connect to the server via FTP, access the /wp-content/themes/ folder located within the site’s root folder. All your installed themes will be here. Before proceeding, you should make a backup if you don’t already have one. You can back up your theme by selecting it, right-clicking, and then choosing the Download option to transfer it to your computer and make a backup.

Choosing the Download option

After ensuring you have an up-to-date backup of your theme on your computer, you can delete it from your site. Just right-click on it and select Delete from the dropdown.

Select Delete from the dropdown

When you delete your active theme from the site, WordPress automatically uses one of the default themes, if you have them (Twenty Twenty, Twenty Nineteen….). If don’t, you can pick a default theme to install via FTP now.

After that, check your website in a browser to see if the error still appears. If the error is gone, it was likely the cause of the problem. In that case, you should check the functions.php file of the theme you were using. There may have been a poorly done update to the theme which led to the error.

You should check the entered functions to see if there’s an error in the code itself. Also, if you spot unnecessary spaces at the end of the functions.php file, you can remove them—sometimes this works to solve the problem with the theme.

Another possible solution is to download a new copy of the theme and reinstall it on your website. Of course, you can always contact the theme author for help in solving the problem.

Check PHP Resources on the Server

Another thing you can try while troubleshooting the 504 error is checking the PHP resources on the server. If the current value for max_execution_time in the php.ini file isn’t already set to 300 you should increase it by adding the following code:

max_execution_time 300

There are several ways to increase the max execution time. If you realize you need help managing it, you should contact your host provider for assistance.

Disable CDN

CDNs or Content Delivery Networks are used to serve static website resources like CSS stylesheets, JavaScript, and images. They are an important tool for improving your website’s speed, particularly if the site has large volumes of traffic. However, sometimes the 504 error is caused by the CDNs instead of the server.

So, if you are using a CDN you can temporarily disable it to check if this is the reason why a 504 error has occurred. Since the process to disable a CND differs depending on which one you’re using, you should contact your provider for more detailed information on the procedure.

When you disable the CDN, try to access your website to check if error 504 still occurs. If the problem persists, you can turn the CDN back on and try one of the other troubleshooting methods in the article to fix the error.

Final Thoughts

The 504 gateway timeout errors in WordPress most often occur due to server problems or the use of a third-party plugin. However, as you’ve seen, there are many different ways to troubleshoot them.

If you’ve tried all our proposed solutions and the 504 gateway timeout error persists, we recommend that you contact your hosting provider’s support team. Make sure to describe what steps you’ve taken to resolve the issue and provide them with as much information as possible to expedite the process of finding the solution.

Post your comment

Comments0