Call Us! [visitorlocation]
Call Us! [visitorlocation]

Need Help?

Our experts will login to your server within 30 minutes to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

‘504 Gateway Timeout error’ in WordPress – 9 easy ways to fix this problem

There is nothing more irritating than your website displaying a blank screen with an error message.

504 Gateway Timeout” is one such common error in WordPress websites.

At Bobcares, we resolve such complex website errors as part of our Server Management Services to web hosts.

Today, we’ll discuss the top 9 causes of this error and how we fix it.

 

‘504 Gateway Timeout’ error in WordPress – What this means?

Before we move on to the reasons for this error, let’s get an idea of this error first.

These days, a common method to speed up the websites is to use a proxy server in front of the web server.

And, this proxy server handles the incoming requests and pass it to the web server.

504 Gateway Timeout error occurs when the proxy server doesn’t receive a timely response from the backend server.

 

504 gateway timeout wordpress

504 Gateway Timeout error explained

 

Visitors will see different variants of the error message like this:

504 Gateway Timeout
Error 504
Gateway Timeout Error
Nginx 504 Gateway Timeout
A blank white screen

 

Although the error message differs, the reasons for this error are common.

 

‘504 Gateway Timeout’ error in WordPress – Causes and Fixes

Now, let’s why WordPress shows 504 Gateway Timeout errors and how our Dedicated Support Engineers fix it.

1) Client side issues

Usually, 504 Gateway Timeout error pops up due to server side issues. But, misconfigurations on the user side may also result in this error.

This error can occur on the client side in the following situations.

  • The browser settings are not configured properly.
  • Network device issues.
  • Incorrect proxy server settings in browser.
  • Issues with VPN service.
  • ISP or local firewall issues.
How we fix?

So, our Hosting Engineers contact the customer to perform these steps to confirm whether the issue is at the client’s side.

  • Sometimes, the WordPress hosting server may be overloaded and customers see this error, so we ask them to clear the browser cache and try reloading the WordPress website.
  • Try to load from another browser or in incognito window.
  • Similarly, this can happen when network devices like router, modem, etc. are configured incorrectly. Here, we suggest the customers to restart the network devices.
  • Disable the local VPN service for browsing.
  • Try to access Wodpress application from different location or network.
  • Clear the outdated DNS cache.
  • Check with ISP or local firewall issues.
  • Confirm that the browser’s proxy server settings are correct.

 

If the problem is not on the client’s side, our Hosting Engineers check the web server logs and WordPress error logs to identify the source of the problem.

For example, we add the below code in the WordPress wp-config.php file to enable WordPress error logs.

define( 'WP_DEBUG', true ); 
define( 'WP_DEBUG_LOG', true ); 
define( 'WP_DEBUG_DISPLAY', false );

 

From the details in the logs, we’ll narrow down the reason for the error.

Based on our experience with WordPress website problems, the following are the main server side causes that can trigger 504 Gateway Timeout errors.

 

2) DNS issues

504 Gateway Timeout error may occur due to DNS problems.

DNS changes are required during migration to new servers, hosting provider switch, etc. But, these DNS changes are not instant, and need some time to propagate globally.

So, when a customer browses the website during this propagation period, the browser can’t get the correct IP address and hence the connection times out.

That’s why, our Hosting Engineers always lower the DNS TTL value to reduce the DNS propagation period.

 

How we fix?

In this case, our Support Engineers check if the DNS propagation period is complete using the dig command.

dig +trace domain.com

 

If not, we’ll update the customer to verify after the propagation period.

In addition to that, we verify the domain’s DNS settings and fix any resolution errors we find out.

 

3) Issues with CDN

It’s now a common trend that website owners use CDN(Content Delivery Network) to improve the website load times.

But, if this is not properly configured, it can result in 504 timeout errors.

Some of the common configuration errors that we see are domain IP address not properly set in CDN, server firewall blocking CDN, etc.

 

How we fix?

In such cases, our Hosting Engineers first identify whether CDN is the culprit by the disabling CDN service for the website.

If the website works, we’ll review the CDN settings like DNS, firewall, etc. and sort out the issues identified.

4) Corrupted WordPress database

It’s true that database is the key part of a WordPress application.

So, a corrupted database can prevent the working of a WordPress website and cause 504 Gateway Timeout errors.

 

How we fix?

Here, our Hosting Engineers check the database server logs to identify the corrupted database.

Once we identify the corrupted database, we repair the database using mysqlcheck to see if that works.

For instance, we use the below command to repair a database table.

mysqlcheck -r DATABASE TABLE

 

Replace DATABASE with database name and TABLE with database table.

Most importantly, before making any changes, we backup the database.

[Do you need help to recover your corrupted database? Our Server administrators are here for your help.]

 

5) Corrupted plugins or themes

Eventhough WordPress plugins or themes are less likely to cause this error, there is still a chance.

In other words, an outdated or incompatible plugin/theme, a caching plugin that makes too many requests to the server, can sometimes slow down the website and cause 504 errors.

 

How we fix?

We’ll deactivate all plugins associated with the WordPress site to confirm that plugins create a problem.

Our Hosting Engineers connect to the hosting account via FTP, and rename the plugins folder to something else. This deactivate all the plugins.

And, if this is successful, we’ll reactivate each plugin one by one and isolate the faulty plugin.

If that doesn’t work, we try switching to a default WordPress theme like TwentySixteen.

And, if the website works fine, we’ll remove the faulty theme and upload a fresh copy. If it’s not fixed, then only the theme developer can help here.

 

6) High load on origin server

Heavy load spikes causes services to not respond.

Here, proxy server wait for an output from origin server and eventually times out.

The most common reasons for load spikes are compromised server, heavy website traffic, DDoS or brute force attacks, application bugs that cause resource hogging, and so on.

How we fix?

Our Support Specialists will first identify the abused resource. Then, we find out which service is abusing that resource.

At this point, we identify the user who owns the script or software for abusing the service.

[And, your server is constantly under high load? Our experienced Server Administrators can fix it in minutes.]

7) Insufficient proxy timeout values

504 Gateway Timeout error can occur when a web server takes more time to complete the requests.

And, by that time, the proxy server will reaches its timeout values(timeout for the connection between proxy and origin server).

For example, slow queries can lead to such problems.

How we fix?

For proxy and web servers, we check the timeout values and fine tune it to avoid timeout errors.

For example, we adjust the following parameters in Nginx servers to avoid timeout errors.

proxy_connect_timeout
proxy_send_timeout
proxy_read_timeout
fastcgi_send_timeout
fastcgi_read_timeout

 

In addition to that, we adjust the PHP parameter max_execution_time in php.ini to bring positive results.

But, blindly increasing these values can affect server performance.

So, we only adjust the timeout settings after analyzing the server resources and server performance.

[Need help to tweak your proxy server timeout values? Our Support Experts are here for your help.]

 

8) Firewall restrictions

Firewall is the keystone for server security. If not properly configured, it can block legitimate requests.

Sometimes, the firewall on the origin server can be improperly configured, or have rules that prevent the connection from being properly established.

As a result, it throws 504 Gateway Timeout in WordPress websites.

 

How we fix?

Our Server Security Specialists audit the firewall blocks and removes any unnecessary rules that hinder the connection to the server.

We modify the firewall rules in a way that it doesn’t create  security risk on the server.

 

9) Slow web server/Network connectivity issues

Sometimes, the back end web server like Apache, which handles incoming requests, can be too slow to respond due to performance problems or high traffic levels.

Similarly, network connectivity problems between the proxy server and web server can cause delays in getting response for HTTP requests.

In both cases, the result is 504 Gateway Timeout error on WordPress websites.

 

How we fix?

For slow web servers, our Server administrators optimize web server and tweak web server configuration parameters to improve the performance.

Likewise, we use tools like traceroute to troubleshoot network connectivity problems and fix them.

 

Conclusion

In short, 504 Gateway Timeout errors on WordPress websites can occur due to DNS problems, client side issues, corrupted databases, and more. Today, we’ve discussed the top 9 causes for this error and how our Dedicated Support Engineers fix it.


PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

SEE SERVER ADMIN PLANS

Server Management

Submit a Comment

Your email address will not be published. Required fields are marked *