How to Fix 504 Gateway Timeout Error on WordPress – The Comprehensive Guide
How to Fix 504 Gateway Timeout Error – Comprehensive Guide.
There is nothing more frustrating and annoying than browsing on your WordPress website and encountering a white screen with an error message – 504 Gateway Timout Error.
For many blogs and e-commerce sites these errors result in the loss of sales and revenue from visitors instantly bouncing and customers unable to complete their purchases.
Here we will get into what is 504 gateway timeout error, the causes of 504 gateway timeout error and some recommendations on how to fix 504 gateway timeout error on your WordPress site.
Read more below about what causes this error and what you can do to prevent it in the future.
- What is 504 Gateway Timeout Error?
- 504 Gateway Timeout Error Variations
- Causes for 504 Gateway Timeout Errors?
- How to fix 504 Gateway Timeout Error?
Table of Content
Below are the content on How to Fix 504 Gateway Timeout Error on WordPress- The Comprehensive Guide.
Click on any of them to get directly to your preferred section or you can scroll down slowly and read from the beginning.
- What is 504 Gateway Timeout Error?
- 504 Gateway Timeout Error Variations.
- Causes for 504 Gateway Timeout Error?
- Slow Server
- 504 Gateway Timeout Error PHP Workers
- Problems With The Firewall
- Network Connection
- HTTP Timeouts
- 504 Errors Impact On SEO
- How to Fix The 504 Gateway Timeout Error?
- How to Resolve Http 504 Gateway Timeout Error?
- 504 Bad Gateway Error Solutions for Users
- 1. Refresh Or Relead The Page
- 2. Clear Your Browser Cache
- 3. Try In Incognito Mode
- 4. Try Another Browser
- 5. Restart Your Network Device
- 6. Disable Proxy Settings
- 7. Clear Local DNS Cache
- 8. Check On Different Devices
- 9. Check DNS Issues
- 504 Bad Gateway Error Solutions for Developers
- 1. Check Your Server
- 2. DNS Propagation Check
- 3. Check Plugins & Themes
- 4. Check Error Logs
- 5. Check Nginx Settings
- 6. Check With Hosting Provider
- 7. Disable CDN or Firewall
- 8. Spam, Bots & DDoS Attack
- 9. Contact Support Team
Further Reading: How to Encourage More User-Generated Content – UGC
What is 504 Gateway Timeout Error?
Hypertext Transfer Protocol – HTTP status codes starting with 5 are server-side errors.
They appear when the request cannot be performed due to a connection failure between several servers.
In simple term, this means that the server could not complete your request within the stipulated time period.
There are many error messages that you might see but some common errors that you might encounter are:
- The White Screen of Death.
- Error Establishing a Database Connection.
- Too Many Redirect Error.
- 502 Error Bad Gateway.
Further Reading: 17+ Ways to Boost Low Conversion Rate in E-commerce
504 Gateway Timeout Error Variations
Due to all the different web browsers, operating systems and servers – a 504 gateway timeout error can present itself in a number of different ways. They will all still have the same meaning.
Below are just a few of the many different variations you might see pop up:
- 504 Gateway Timeout
- 504 Gateway Timeout NGINX
- NGINX 504 Gateway Timeout
- Gateway Timeout Error
- Error 504
- HTTP Error 504
- HTTP Error 504 – Gateway Timeout
- HTTP 504
- 504 Error
- Gateway Timeout (504)
- This page isn’t working – Domain took too long to respond
- 504 Gateway Time-out – The server didn’t respond in time
- A blank white screen
Some companies even have custom pages for 504 gateway timeout errors.
Causes for 504 Gateway Timeout Error?
Before we consider the error itself it is important to understand how they are generated.
Whenever you start your browser and visit a website it sends the request back to the server where it is hosted on.
The web server then processes the request and sends back the requested resources along with what they call an Hypertext Transfer Protocol – HTTP header.
This HTTP header contains one of many HTTP status codes to communicate whether everything is OK or if something has gone wrong.
Not all HTTP status codes are bad. For example a 200 status code indicates everything is OK.
Any status code in the 500’s is error codes (500, 501, 502, 503, 504, 520,etc.) that have different meanings.
These indicate that the request was accepted but the server prevented the execution of the request.
In simple terms a 504 gateway timeout error means that the server – acting as a gateway – timed out waiting for another server to respond.
The code returns when there are two servers involved in processing a request and the first server times out waiting for the second server to respond.
In addition to server timeouts – there are other causes leading to 504 gateway timeout error:
- Slow Server.
- 504 Gateway Timeout Error PHP Workers.
- Problems With The Firewall.
- Network Connection.
- HTTP Timeouts.
- 504 Errors Impact on SEO.
1. Slow Server
It is possible that the server where you host your WordPress website is responding too slowly and therefore it generates gateway timeout errors.
2. 504 Gateway Timeout Error PHP Workers.
PHP workers are used to running code on your WordPress site. Demanding sites can make all Hypertext Preprocessor – PHP workers busy.
In this case they form a queue and if the queue and backlog are full then the old requests are ignored.
You can ask your host provider to increase the number of PHP workers. Additional PHP workers for a site allow executing several requests simultaneously.
Therefore it is always advisable to make sure you or your responsible administrator opt for a trusted and reliable hosting provider like Best-Digital Marketing Services who are able to provide the best and are available when needed.
3. Problems with the Firewall.
The firewall on your server may contain errors due to incorrect configuration or rules blocking the connection.
There is also the possibility that your WordPress security plugins might be blocking the communication between servers or even your local or Internet Service Provider – ISP or Internet Protocol – IP address.
To rule this out you can try accessing the site from a different Internet connection. On certain occasions – Distributed Denial of Service – DDOS protection systems can become over-sensitive and start blocking the requests from servers.
With Best-Digital Marketing you will never encounter the http 504 gateway timeout error due to server inadequacy as we provide dedicated servers with SSD storage, unlimited bandwidth, daily offline backup, daily malware scanning and clean-up, Let’s Encrypt SSL and 24/7 customer support by our experts with a starting price of just £39.99.
Further Reading: How to Write a Good Meta Description for SEO
4. Network Connection.
If there is a problem with the network connection between the proxy server and the web server then this can lead to delays.
There may also be network problems with the load balancer – if it is used.
5. HTTP Timeouts.
This can occur when the connection between your browser and the web server is held open for too long. These commonly happen when running WordPress imports.
One way to resolve this is to switch to a faster internet connection or you can use a tool with support for WP-CLI such as the WordPress Importer plugin and run the import directly on the server – bypassing the HTTP connection entirely.
6. 504 Errors Impact on SEO.
Unlike 503 errors which are used for WordPress maintenance mode and tell Google to check back at a later time – a 504 error can have a negative impact on SEO if it is not fixed right away.
If your site is down for say 12 minutes then it is being crawled consistently and majority of the time the crawler will simply get the page delivered from cache or Google might not even have a chance to re-crawl it before it is back up and in this case you are completely fine.
Should your site be down for an extended period of time say 5 hours or more then Google might see the 504 gateway timeout error as a site-level issue that needs to be addressed.
This will definitely have an impact on your rankings. If you are worried about repeat 504 gateway timeout errors then you should figure out why they are happening to begin with and some of the solutions below can help.
Further Reading: 31+ Creative Ways How to Drive Traffic to Your Website
How to Fix 504 Gateway Timeout Error
Where should you start troubleshooting if you see a 504 gateway timeout error on your WordPress site?
Without a great deal of context it can be frustrating and overwhelming where to begin.
Usually these are network connectivity issues and or problem with the server at which the site is hosted.
However it can also be a client-side issue or even a result of a third-party plugin.
So let us dive in and check out ways how to fix the 504 gateway timeout error and get back up and running.
How to Resolve Http 504 Gateway Timeout Error
There are a few measures that can be taken to get ahead of the 504 gateway timeout error which is caused by either the user or developer’s side.
These are in no particular order or importance since all of them are equally important and can be used in different combinations depending on individual circumstances.
The common fixes given below are divided into two section:
for the users
for developeres or web administrators
504 Gateway Timeout Error Solutions for Users
1. Refresh or Reload the Page
One of the first things you should try to do when you encounter a 504 Gateway Timeout Error is simply wait a minute and refresh or reload the page by pressing F5 or Ctrl+ F5.
It could be that the host or server is simply overloaded with high amounts of traffic and the site will come right back.
Another thing you can do is to paste the website into https://downforeveryoneorjustme.com. This website will tell you if the site is down or if it is a problem on your side.
This website will tell you if your site is out of service or if it is a problem on your side. This tool checks the HTTP status code that is returned by the server.
If it is anything other than a 200 which means Everything is OK then it will mean that your site does not work for everyone.
Further Reading: What is SEO Friendly URL Structure
2. Clear Your Browser Cache
There is a good chance that the corrupted files stored on your browser might be causing this 504 gateway timeout error.
So by clearing the cache of your browser you might be able to resolve this error.
Moreover you should remove the cookies from your browser since this can also help in resolving this error.
3. Try in Incognito Mode
Another way to fix this 504 gateway timeout error is by starting a new Private or Incognito session in your browser. This should resolve the issue if it is caused by your browser.
Further Reading: What Are The Benefits Of Video SEO?
4. Try Another Browser
You can try to use another browser such as Chrome, Safari, Firefox or Internet Explorer.
If you do not see this 504 gateway timeout error when you change your browser then this indicates that the problem was your browser.
You can try to re-install the browser to check if this resolves the issue.
5. Restart Your Network Device
To do this – simply switch off your internet router from the mains for about 45 seconds to 1 minute.
Then switch the mains back on and ensure you switch your router power button on too and wait for your computer to establish a connection again. This should alleviate the 504 gateway timeout error issues.
6. Disable Proxy Settings
Sometimes you might see a 504 timeout error if you are utilising a proxy service. This is usually rare especially on the client-side.
However one might have been set without you even knowing it. Follow these tutorials on how to disable or check to ensure no proxy settings are enabled:
Further Reading: How Much Does Video SEO Cost?
7. Clear Local DNS Cache
You can also try flushing your local DNS cache to see if this resolves your 502 bad gateway error issue. This is similar to clearing your browser cache.
In Windows simply open up CMD or Command Prompt and enter the following:
ipconfig /flushdns
Command prompt > ipconfig / flushdns
You should see a Successfully flushed the DNS resolver Cache – if it worked correctly.
For MacOS users you can enter the following in the terminal:
dscacheutil -flushcache
Note: There is no success message on Macs.
Finally you can temporarily change your client side DNS servers. By default DNS servers are automatically provided by your ISP but you could temporarily change them to a public DNS server provided by Google.
Most people prefer to use Google’s public DNS constantly because in the long term they are more reliable and a lot faster.
8. Check On Different Devices
Try opening the site on different devices like laptops, tablets or on mobile.
If nothing could help to fix the 504 gateway timeout error then this step will confirm and help you determine if the problem is on the server side or it is from your side.
9. Check DNS Issues
A 504 gateway timeout error could also be because of a Domain Name System – DNS issue such as the domain is not resolving to the correct IP address.
If you have just migrated your WordPress site to a new host provider then is it important to wait for things to fully propagate which can take up to 48 hours in some cases.
This will depends upon the Time to Live –TTL value of your DNS records and also check and see if there is no typo errors.
504 Gateway Timeout Error Solutions for Developers
If you are a developer or a server manager and you are facing the 504 gateway timeout error then the chances that you might be facing this error is because of other factors.
So trying the following solutions should eliminate the issue.
1. Check Your Server
You can determine whether your server is reachable or not by conducting a trace-route or ping test on the server IP.
2. DNS Propagation Check
A 504 gateway timeout error can often be caused by problems with the Domain Name System –DNS server. There are two reasons for this.
This happens on the server side when the domain name is not changed to the correct IP address.
If you have just migrated your WordPress website to a new host provider then it is important to wait so the address can be added to DNS base.
In most cases it can take up anything between 24 to 48 hours depending on your host provider and the DNS records Time to Live –TTL value.
You can use the DNS test tools like DNSMap, DNS Checker or MX Tool Box for this purpose. They are free to use to check your DNS are up and running and correctly configured.
Further Reading: How to Do Keyword Research for SEO – A Simple Guide
3. Check Your Plugins and Themes
Many users believe that third-party plugins or themes do not lead to 504 gateway timeout errors and in most cases this is true.
However according to many users’ and our experience a slow non-cached plugin request can cause these delays since it uses more of your PHP workers.
Once you reach the limit of PHP workers the queue will remove your old requests which will cause the 504 errors. They should not be confused with 502 errors which are the result of a 60 seconds timeout.
There are several ways to fix the issue and one of them is to de-activate all your plugins. Remember that you will not lose your data if you disable them.
A. WordPress Admin Panel
You can do this by accessing your admin through WordPress dashboard, a quick way to do this is to browse to Plugins and select Deactivate from the bulk actions menu.
This will disable all of your plugins and if this fixes the issue then you will need to find the culprit.
Start activating each plugin one by one and reload or refresh the website after each plugin has been activated.
When you see the 504 gateway timeout error returns then you have found your problematic plugin. You can either contact the respective plugin developer for help or create a support ticket in the WordPress repository.
B. FTP Client
If you do not have access to the admin panel you can use the File Transfer Protocol – FTP client to connect to your server and rename the plugin folder to something like plugins_old and re- check your site again.
If it works then you will need to test each plugin one by one. Rename your plugin folder back to plugins and then rename each plugin folder inside of if it – one by one until you find the culprit.
You could also try to replicate this on a staging site first.
Make sure that all your plugins, themes and the WordPress core are updated to the latest version and ensure that you are running a supported version of PHP.
If the plugin contains bad code then you may need to contact the WordPress developers to solve this problem.
4. Check Error Logs
You can also use your error logs which you can view in a section of the hosting dashboard. This can quickly help you narrow down the issue especially if it is a plugin issue on your website.
If your hosting provider does not have a logging tool then you could also add the following code to your wp-config.php file to enable the WordPress debug mode:
define('WP_DEBUG',
true
);
define('WP_DEBUG_LOG',
true
);
define('WP_DEBUG_DISPLAY',
false
);
5. Check Nginx Settings
If you are managing your own server and WordPress sites on Nginx + FastCGI (php-fpm) or Nginx as proxy for Apache then there are some additional settings you can change to help prevent 504 gateway timeout errors.
A. 504 Gateway Timeout Error on Nginx + FastCGI (PHOP-FPM)
B. 504 Gateway Timeout Error on Nginx Proxy
If you are using Nginx as a proxy for Apache then you need to add the following to your nginx.conf file:
proxy_connect_timeout
600;
proxy_send_timeout
600;
proxy_read_timeout
600;
send_timeout
600;
Then simply reload or restart Nginx.
service nginx reload
Further Reading: Ways To Create Quality Backlinks
6. Check Issues With Your Hosting Provider
Server issues are one of the most common reasons why users experience a 504 gateway timeout errors on their WordPress websites. In simple terms – Nginx or Apache waits for a response until the waiting time has expired or timed out.
We get a lot of clients that come to Best-Digital Marketing Services due to the fact that they are constantly receiving these errors at their current WordPress hosting site.
504 errors mostly occur on high traffic online and e-commerce stores with a lot of daily visitors. The latter may have also installed numerous e-commerce plugins like Woo commerce plugins.
These usually have many non-cached requests which can cause the server to overload however such error can also occur in a variety of different types of website including blogs.
Many hosts usually offer to upgrade to a more expensive tariff plan to fix this problem and this usually helps to solve this issue which is often not necessary.
Here at Best-Digital Marketing Services we utilise truly unlimited web hosting this means that every WordPress site is housed in its own isolated location that has all of the software resources required to run it (Linux, Nginx, PHP, MySQL).
Many shared WordPress hosts do not have this capability and therefore a high-traffic neighbouring site causing 504 gateway timeout errors could very well impact your site.
Your sites are isolated and our infrastructure is built to easily handle thousands of concurrent connections. Even MySQL databases are hosted at localhost.
This ensures that there is no latency between machines which results in faster queries and less chance of timeouts occurring anywhere in-between.
Many clients who migrate to Best- Digital Marketing see huge decreases in their overall load times.
A. Website Monitoring & Downtime Alert Tools
It is also important to note that 504 errors can deceptively look a lot like 503 service unavailable errors or even 502 bad gateway errors but they are in fact different.
If you want to prevent such errors from happening on your site in the future then you can also utilise tools like updown.io or statuscake.com to monitor and notify you immediately if problems occurs.
It periodically sends an HTTP HEAD request to the URL of your choice or simply use your homepage.
The tool allows you to set check frequencies of:
- 15 seconds
- 30 seconds
- 1 minute
- 2 minutes
- 5 minutes
- 10 minutes
It will send you an email if and when your site goes down. Here is an example below.
This can be especially useful if you are on a shared or virtual hosting which tends to overcrowd their servers.
That is why we always recommend going with a managed WordPress hosting or dedicated hosting.
Further Reading: 5 Trust Badges That Reduce Cart Abandonment for Businesses
7. Temporarily Disable CDN or Firewall
It could also be an issue with your Content Delivery Network – CDN. If you are using a third party CDN provider then an easy way to troubleshoot this is to temporarily disable your CDN.
For example if you are using a free CDN enabler plugin on WordPress then you can simply deactivate the plugin and test your website.
If you are unable to access your site’s dashboard then simply log in to your site via Secure File Transfer Protocol –SFTP and rename the plugin’s folder to cdn-enabler_old.
This will temporarily disable the CDN connection. The same goes for WP Rocket or any other plugin you might have hooked up to your CDN.
This could also happen if you use the back proxy services like Cloudflare or Sucuri since they use the additional firewall in between. Most of them cache 500 status codes when they are returned by your origin server.
Many users have noticed that this issue happens once in a while on Cloudflare’s free plan service. Unfortunately since Cloudflare is a complete proxy service there is no quick way to disconnect it.
However before you go pointing the finger at Cloudflare – it is important to know that there are two different types of 504 gateway timeout error variations as shown below:
A. 504 Gateway Timeout at Cloudflare (Variation 1)
If you see the following screen then this is actually a problem on Cloudflare’s end which means that you should reach out to them for Cloudfare support or check their status page.
B. 504 Gateway Timeout at Cloudflare (Variation 2)
If you see the following screen then this is a problem with your WordPress hosting server – in which case you will need to skip over to recommendation No: 5 above.
Most likely they are already aware of the issue and have their team working on it.
C. 504 Gateway Timeout at Cloudflare with Uploads
Another reason for a timeout could be related to the size of your uploads. They do restrict POST (uploads) to 100MB on their Free or Pro plan.
We have occasionally seen clients have issues with files or upload smaller than this and the issue lies with your host’s end or Cloudflare.
An easy way to determine this would be by simply bypassing Cloudflare with your DNS hosts file and trying your upload again or simply disable Cloudflare temporarily.
If you are using Cloudflare with WordPress then it is always recommended to use their free plugin and exclude important URLs from caching such as your WordPress admin area.
Further Reading: How to Find and Fix Broken Links in WordPress
8. Spam, Bots and DDoS Attacks
Perhaps your website is been spammed by bots or undergoing a DDoS attack which can lead to uncached requests and server overload. And this results in a 504 gateway timeout error.
You can take a look at your server analytics and see if there are any patterns emerging by asking your hosting provider for this information or data.
The first report we recommend looking at is the top end client IP addresses. This can be useful especially if your site suddenly began to generate large bandwidth or traffic or getting attacked by bots.
The second report we recommend to look at is the requests and bots. You can quickly compare the traffic to your website with the number of bots.
However remember that not all bots are bad. Google Bot is a good example as it scans the site to index the content and promote it in the search engine.
The third report we recommend is the cache analysis. Here you can see what requests are missing the cache, bypassing the cache and also the top locations of your site.
For the best performance and stability reasons you should try to cache as many requests as possible.
This is not always possible since some sites such as those running Woo Commerce are generating a lot of un-cached requests.
They have to for the features like the shopping cart and checkout process to work correctly and stay in sync.
A. Blocking Spams and DDOS Attacks
If you find and identify traffic or IP addresses that need to be blocked then you can use the WordPress security plugin.
However not all hosting providers allow you to install security plugins since such plugins can influence the speed and performance of your website especially when they scan the server.
Secondly the IP blocking feature may not work because hosting provider can use load balancers from the Google Cloud Platform.
IP addresses can always be blocked by the hosting support service but depending upon the length and scale of the attack this could be a never-ending process of blacklisting IPs which in most cases does not solve the problem fast enough.
When the attacks or spam is blocked in one area, they are often switched to other zones – changing IP addresses or using other proxy addresses.
Therefore we recommend installing a security solution such as Cloudflare or Sucuri.
9. Contact Support Team
If you are still constantly getting 504 gateway timeout error and you have exhausted all the above options and nothing else helps to fix it then contact your hosting technical support team.
Describe to them all the steps you have taken to identify the error caused and provide them with as much information as possible.
This will greatly speed up your request and the process o resolve this issue.
Further Reading: Get Traffic to Your Website Fast
Conclusion
As you can see there is a multitude of different ways and methods – how to fix 504 gateway timeout errors on your WordPress site.
Usually these are a server issue in which case you can quickly reach out to your hosting provider to get it resolved.
But it is also important to remember that they can actually be caused by third-party plugins or overwhelming backlog or queue overflow of your PHP workers.
If you are having these issues then contact us today or our support team who specialises in web performance optimisation.
If you enjoyed this post then share this on your social media and you will love Best-Digital Marketing’s hosting platform. Turbocharge your website and get 24/7 support from our hosting team.
For full Web Hosting Services package functionality
and select the package that suits your business needs.
If you prefer to discuss your requirements first just
or fill your details with a message of your requirements at
Further Reading: Benefits of SEO
For more information about our services and how we can help you with Web Hosting Service needs:-
Join Our Blog Email List
I might send you 1 or 2 emails a month. Most probably less. Lots of tricks, tips, humour hacks, guides and exclusive ramblings in there for your good mental health and education.
You can unsubscribe anytime whenever you like. No risk or regrets. We will never spam your Inbox.
Hope you are enjoying and learning a lot with abundance of information about:-