SlideShare a Scribd company logo
1 of 13
Download to read offline
By Aabhas Vijay |
WPOven Blog
How to fix 504 Gateway Timeout Error on your
WordPress Website?
2 January, 2020
There is nothing more annoying than a blank screen with an error message instead of your
website’s content. Today, we’ll take a look at the 504 Gateway Timeout Error, and also give
some recommendations on how to fix it on your WordPress site. For most blogs and online
stores, such errors can lead to loss of revenue. The visitors immediately leave the resource
with a bad experience, and cannot make purchases. So let’s dive in –
In this article, we will cover –
1. What is the 504 gateway Timeout error?
2. Causes for 504 Gateway Timeout Error?
3. How to fix the 504 gateway timeout error?
Search …
What is the 504 Gateway Timeout Error?
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.
504 Gateway timeout error is an HTTP status code. It appears when one server does not
receive a timely response from another one that works as a gateway or proxy. Simply put,
this means that the server could not complete your request within some period.
There are many error messages that you might see. Some common errors that you might
have encountered:
The white death screen
Error Establishing a Database Connection
Too Many Redirect Error
502 Error Bad gateway
As there are a variety of web browsers, operating systems and types of servers, they
display the 504 error in many ways. All of them, as a rule, means the same. We listed some
of the most popular version:
504 Gateway Timeout
504 Gateway Timeout NGINX
NGINX 504 Gateway Timeout
Gateway Timeout Error
Error 504
HTTP Error 504
Gateway Timeout Error 504
HTTP 504
504 Error
Gateway Timeout (504)
504 Gateway Time-out – The server didn’t respond in time
Causes for 504 Gateway Timeout Error?
Before we consider the error itself, it is important to understand why it appears. Whenever
you start your browser and visit a URL, it sends the request back to the server where it is
hosted. The web server then processes the request and sends you the requested resources
along with an HTTP header. This header contains one of the many HTTP status codes that
let you understand whether everything is okay or something went wrong. Not all status
codes are bad. For example, the status code 200 indicates that everything works fine.
Any status code in the 500-s is error codes (500, 501, 502, 503, 504, etc.) that have
different meanings. They indicate that the request was accepted, but the server could not
execute it.
To that extent, the 504 error means that the server running as a gateway is out of time to
wait for a server response. The code is returned when there are two servers involved in
processing the request, and the response time from the second server has expired.
In addition to server timeouts, there are other causes, leading to 504 error:
Slow server. It is possible that the server where you host your WordPress website is
responding too slowly, and therefore it generates gateway errors.
Insufficient PHP workers. PHP workers are used to running code on your WordPress
site. Demanding sites can make all PHP workers busy. In that case, they form the
queue. If the queue and the backlog are full, old requests are ignored. You can ask
your hosting to increase the number of PHP workers. Additional PHP workers for a site
allow executing several requests simultaneously.
Problems with the firewall. The firewall on your server may contain errors due to
incorrect configuration or rules blocking the connection.
Network connection. If there is a problem with the network connection between the
proxy server and the webserver, this can lead to delays. Also, there may be network
problems with the load balancer, if it is used.
How to fix the 504 gateway timeout error?
When you see a 504 Gateway timeout error, you might be confused about what to do? You
can always try the following actions –
1. Try to reload the page
2. Try a different browser
3. Check on different devices
4. Disable the proxy
5. Check DNS records propagation
6. Temporarily disable the CDN
7. Check the issues with your hosting provider
8. Clean the site from spam, bots and protect it from DDoS attacks
9. Check your plugins and themes
10. Check the logs
11. Change Nginx options
Try to reload the page:
One of the first things you should do when you face the 504 Gateway Timeout Error is just
to wait a minute and reload the page. Perhaps the hosting or server is simply overloaded,
and the site will quickly return to work.
Another thing you can do is check your website status on downforeveryoneorjustme.com.
This site will tell you if the site is out of service only for you or for all visitors. The tool checks
the HTTP status code that is returned by the server. If the code differs from 200, then, in
this case, you will see the Down pointer. It will mean that the site does not work for
everyone.
Try a different browser:
In case the site is online, but you still see the 504 gateway timeout error, try changing your
browser to another one. Clear the browser cache or use the incognito mode, this can also
help determine if the error is caused by the browser.
Check on different devices:
Try opening the site on different computers, on different networks or on mobile devices. If
nothing could help to fix the 504 gateway timeout error, this step will help you determine if
the problem is on the server side or it is local.
Disable the proxy:
Sometimes you may get 504 error if you use a proxy server. These cases are very rare,
especially on the client-side. Read the guides on how to disable proxy on Windows and
Mac.
Check DNS records propagation:
504 gateway timeout error is often caused by problems with the DNS server. There are two
reasons for that. On the server side, it happens when the domain name is not changed to
the correct IP address. If you just moved the WordPress website to a new hosting, it’s
important to wait when the address will be added to DNS base. In most cases, it takes up to
24 hours. It all depends on your DNS records TTL value. You can use a free tool like
DNSMap to check if your DNS has spread all over the world.
The second DNS issue relates to the client side. In this case, you can clear your local DNS
cache. This is similar to clearing the browser cache.
In Windows, simply open a command line and type the following:
You should see the “Successfully flushed the DNS Resolver Cache” message.
In macOS, type the following in the terminal:
Note: there are no messages of successful operations on Mac.
And, finally, you can temporarily change your client DNS servers. By default, DNS servers
are provided by your ISP. You can temporarily change them to a public DNS server, for
example, provided by Google. Some people prefer to use Google’s public DNS constantly
because in some cases they are more reliable.
1 ipconfig / flushdns
1 dscacheutil -flushcache
Temporarily disable the CDN:
Also, the problem may relate to the content delivery network. If you use a third-party CDN
provider, you can try to temporarily disable it. For that, you may use the WordPress plugins.
With them, you will be able to disable the CDN safer.
If you use the back proxy services like Cloudflare or Sucuri, they may cause the 504 error
as they use the additional firewall. Most of them cache 500 state codes when they are
returned by your source server. Many users noticed that issue on Cloudflare free plan.
Unfortunately, since Cloudflare is a complete proxy service, there is no quick way to
disconnect it.
However, before blaming the Cloudflare, it is important to know that there are two types of
504 error:
504 Gateway Timeout in Cloudflare (version 1)
If you see the page looking like that, then, in this case, the problem is on the Cloudflare
side. Contact their user support. Or check their status page. Most likely, they are already
notified about this problem and are working on it.
504 Gateway Timeout in Cloudflare (version 2)
If you see the page looking like that, then this is a problem with your WordPress hosting.
Please follow the recommendations from the next section.
Check the issues with your hosting provider:
Server problems are one of the common reasons why users experience 504 errors on their
WordPress websites. In simple terms, Nginx or Apache wait for a response until the waiting
time has expired.
504 errors are really very popular on sites with a lot of visitors and on e-commerce sites and
online stores. The latter may have installed e-commerce plugins like Woocommerce. They
usually have many non-cached requests. This can cause the server to overload. However,
such error can happen to a variety of website types, including the blogs. Many hosters
usually offer to upgrade to a more expensive tariff plan to fix this problem. And even if this
usually helps to solve this issue, it is often not necessary.
Some hosting provide dedicated resources for each server. This means that each site is
hosted in its own isolated container. It has all the necessary software resources required to
run it (Linux, Nginx, PHP, MySQL). Resources are 100% confidential and do not share with
anyone. But some shared WordPress hosting plans do not have this feature. So any
neighbouring site with high traffic will cause 504 gateway timeout error on your site.
It is also important to note that 504 errors may look very similar to 503 errors (service
unavailable) or even 502 errors (bad gateway). But actually, they are different.
If you want to prevent such errors in the future, you can use a tool like statuscake.com to
track the server state and immediately report any problems. The service periodically sends
an HTTP HEAD request to the specified URL. You can simply set your homepage. In
addition, you are able to choose the checking frequency from 15 seconds to 10 minutes.
The service will send you an email if your site is out of service, indicating the time when it
happened.
This can be especially useful if you are using a virtual hosting, which, as a rule, is
constantly overloaded. This will give you proof that your site did not work (for example, at
night). For this reason, we advise you to move on to dedicated hosting.
Clean the site from spam, bots and protect it from DDoS attacks:
Perhaps your website has been spammed by bots or became a DDoS attack target.
Sometimes this leads to uncached requests and, as a result, to server overload. All that
results in a 504 gateway timeout error. You can learn the server analytics to see if there are
any patterns in it. You can request your hosting provider for this information.
The first report, which we recommend studying, is the top-end customers IP addresses.
Usually, this is very useful, especially if your site suddenly began to generate large traffic or
was attacked by bots.
The second report we recommend to look at is the requests and bots. You can quickly
compare the number of people visiting your website, with the number of bots. However,
remember that not all bots are bad. Google Bot is really a good bot, it scans the site to
index the content and promote it in the search engine.
The third report we recommend is a cache analysis. Here you can see what requests are
missing in the cache, and also what are the top locations of your site. To provide the best
performance and stability, you should try to cache as many requests as possible. This is not
always available because some resources generate a huge amount of uncached requests.
The best example is Woocommerce. These requests are necessary for the correct work and
synchronization.
If on your site you find and identify traffic or IP addresses that need to be blocked, you can
use the WordPress security plugin. However, not all hostings allow you to install security
plugins. First, such plugins can influence the performance, especially when they scan the
server. Second, the IP blocking feature may not work in them because hosting provider can
use load balancers from the Google Cloud Platform.
Naturally, IP addresses can always be blocked by the hosting support service. However,
depending on how long and large is an attack, this can never end. When the attacks or
spam is blocked in one area, they are often switched to other zones, changing IP addresses
or using other proxies. Therefore, in this case, we recommend installing a security solution,
such as Cloudflare or Sucuri.
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. But, according to many users’ experience, a slow
non-cached plugin request can cause the delays, since it uses more of your PHP workers.
Once you reach the limit of them, the queue will remove your old requests, which can 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. One of them is the deactivation of all your plugins.
Remember that you will not lose your data if you disable them. If you have access to the
admin panel, simply go to the Plugins section and select Deactivate feature. This will
disable all of your plugins.
If this fixes the issue, you need to find its source. Activate the plugins one by one, restarting
the site after each activation. Once you see the 504 error, you will be able to identify the
problematic plugin. Then you can contact the plugin developer for help or create a ticket in
the WordPress repository.
If you do not have access to the admin panel, you can use the FTP client to connect to your
server. Rename the plugin folder to something like plugins_old. Then check your site again.
If this works, you will need to test each plugin separately to find the reason. Rename the
plugins’ folder back. Then rename the plugin folders inside until you find the plugin causing
the issue.
Make sure that all your plugins, themes and the WordPress kernel are updated to the latest
version. And make sure that you are using a supported version of PHP.
If the plugin contains bad code, then you will most likely need to contact the WordPress
developers to solve this problem.
Check the logs:
You can also use your error logs. One can view them in a special section of the hosting
dashboard. You can quickly fix the issue, especially if its source is the website plugin. If
your hosting does not offer logging tools, you can add the following code to the wp-
config.php file to enable logging:
Logs are usually located in /wp-content folder. Sometimes they can be in separate folders.
You can also check the Apache and Nginx logs which are most often located at
/var/log/apache2/error.log (Apache) or /var/log/nginx/error.log (Nginx)
Change Nginx options:
If you are maintaining your own server and WordPress website on Nginx+FastCGI (php-
fpm). Also, you can use the Nginx as a proxy for Apache. In that case, there are additional
settings that you can change to prevent 504 gateway timeout errors.
If you are using Nginx with FastCGI (php-fpm), then you need to first make changes to the
PHP-FPM file. Go to /etc/php5/fpm/pool.d/www.conf (it can vary depending on the PHP
version). Set the following directive:
Then you must modify the php.ini file, which is usually located at /etc/php.ini. Find the
max_execution_time directive. Increase its value to 300 or create a directive if it does not
exist:
Finally, you will need to modify the nginx.conf file. Add the following to your Nginx virtual
host configuration:
Then just restart Nginx and PHP-FPM.
If you use Nginx as a proxy for Apache, then in this case add the following to your
nginx.conf file:
Next, just restart Nginx.
1
2
3
define ('WP_DEBUG', true);
define ('WP_DEBUG_LOG', true);
define ('WP_DEBUG_DISPLAY', false);
1 request_terminate_timeout = 300
1 max_execution_time = 300
1
2
3
4
5
location ~ .php $ {
...
fastcgi_read_timeout 300;
...
}
1
2
service nginx reload
service php5-fpm reload
1
2
3
4
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
Contact Support
If you constantly face 504 gateway timeout error and nothing helps to fix it, contact the
hosting technical support. Try to describe what steps you have taken to identify the error
cause and provide as much information as possible. This will greatly speed up the process.
Conclusion
As you can see, there are many different ways and methods of fix 504 gateway timeout
error on the WordPress site. Typically, this is a problem with the server, and in this case
you need to contact your hosting to solve them. But it’s important to remember that they can
also be caused by third-party plugins or the queue/backlog overflow of your PHP workers.
3 Replies to “How to fix 504 Gateway Timeout Error on your WordPress Website?”
2 9 A P R I L , 2 0 1 9 A T 4 : 3 0 P M
Thanks to the excellent manual
3 M A Y , 2 0 1 9 A T 1 0 : 3 0 A M
Useful information. Lucky me I discovered your web site unintentionally, and I’m stunned
why this
twist of fate didn’t happened in advance! I bookmarked
it.
1 8 J U N E , 2 0 1 9 A T 4 : 2 7 P M
W E B S E R V E R S, W O R D P R E S S E R R O R
Reply
Reply
1 service nginx reload
see here
best restauranT around
raley
Thank you so much for detailing this, I’ve been struggling for weeks with the same problem.
Anyway, i am looking for the cheap linux hosting. Can you suggest me the one most
cheapest hosting provider?
Thank you so much.
Leave a Reply
Your email address will not be published. Required fields are marked *
Comment
Name *
Email *
Website
Save my name, email, and website in this browser for the next time I comment.
Post Comment
P R E V I O U S
All You Need to Know About 502 Error Bad Gateway
Fed up with your slow WordPress Hosting & sub-par support ?
We do things differently at WPOven
View Our Plans
Reply
B r o w s e P a g e
Plans & Features
Blog
Tutorials
Free Themes
Privacy Policy
Take a Tour
Knowledge Base
Affiliates
Refund Policy
Terms & Conditions
H e l p
Contact Us
Login
Signup
Knowledge Base
Tutorials
R e c e n t P o s t
How to fix 504 Gateway Timeout Error on
your WordPress Website?
All You Need to Know About 502 Error Bad
Gateway
How to Fix Error 403 Forbidden for
WordPress
How to Fix
DNS_PROBE_FINISHED_NXDOMAIN
Error?
How To Fix Error 404 Not Found On
WordPress
Copyright © 2020 WPOven

More Related Content

What's hot

The Case for HTTP/2
The Case for HTTP/2The Case for HTTP/2
The Case for HTTP/2Andy Davies
 
WebSockets On Fire
WebSockets On FireWebSockets On Fire
WebSockets On FireJef Claes
 
15 Most Common WordPress Errors and Solution
15 Most Common WordPress Errors and Solution15 Most Common WordPress Errors and Solution
15 Most Common WordPress Errors and Solutionkethyjewel
 
wa-cometjava-pdf
wa-cometjava-pdfwa-cometjava-pdf
wa-cometjava-pdfHiroshi Ono
 
A Holistic View of Website Performance
A Holistic View of Website PerformanceA Holistic View of Website Performance
A Holistic View of Website PerformanceRene Churchill
 
Beating Spam On Your WordPress Website - WordCamp Melbourne 2013
Beating Spam On Your WordPress Website - WordCamp Melbourne 2013Beating Spam On Your WordPress Website - WordCamp Melbourne 2013
Beating Spam On Your WordPress Website - WordCamp Melbourne 2013Vlad Lasky
 
eCommerce performance, what is it costing you and what can you do about it?
eCommerce performance, what is it costing you and what can you do about it?eCommerce performance, what is it costing you and what can you do about it?
eCommerce performance, what is it costing you and what can you do about it?Peter Holditch
 
An introduction to HTTP/2 for SEOs
An introduction to HTTP/2 for SEOsAn introduction to HTTP/2 for SEOs
An introduction to HTTP/2 for SEOsTom Anthony
 
Reducing Server Resources: Improve Costs, SEO, Conversions & UX
Reducing Server Resources: Improve Costs, SEO, Conversions & UXReducing Server Resources: Improve Costs, SEO, Conversions & UX
Reducing Server Resources: Improve Costs, SEO, Conversions & UXMichael Jones
 
Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5Web Directions
 
High Performance Websites
High Performance WebsitesHigh Performance Websites
High Performance WebsitesParham
 
WordPress vs Other Content Management System
WordPress vs Other Content Management SystemWordPress vs Other Content Management System
WordPress vs Other Content Management SystemHTS Hosting
 
Performance in business terms
Performance in business termsPerformance in business terms
Performance in business termsStrangeloop
 
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?Andy Davies
 
Securing Your WordPress Website - WordCamp GC 2011
Securing Your WordPress Website - WordCamp GC 2011Securing Your WordPress Website - WordCamp GC 2011
Securing Your WordPress Website - WordCamp GC 2011Vlad Lasky
 
How to Fix Error 404 in Wordpress
How to Fix Error 404 in WordpressHow to Fix Error 404 in Wordpress
How to Fix Error 404 in WordpressAnny Rathore
 
Site Down: How to Triage Those First Minutes
Site Down: How to Triage Those First MinutesSite Down: How to Triage Those First Minutes
Site Down: How to Triage Those First MinutesJohn Gamboa
 
4.2. Web analyst fiddler
4.2. Web analyst fiddler4.2. Web analyst fiddler
4.2. Web analyst fiddlerdefconmoscow
 
London Web Performance Meetup: Performance for mortal companies
London Web Performance Meetup: Performance for mortal companiesLondon Web Performance Meetup: Performance for mortal companies
London Web Performance Meetup: Performance for mortal companiesStrangeloop
 

What's hot (20)

The Case for HTTP/2
The Case for HTTP/2The Case for HTTP/2
The Case for HTTP/2
 
WebSockets On Fire
WebSockets On FireWebSockets On Fire
WebSockets On Fire
 
15 Most Common WordPress Errors and Solution
15 Most Common WordPress Errors and Solution15 Most Common WordPress Errors and Solution
15 Most Common WordPress Errors and Solution
 
wa-cometjava-pdf
wa-cometjava-pdfwa-cometjava-pdf
wa-cometjava-pdf
 
A Holistic View of Website Performance
A Holistic View of Website PerformanceA Holistic View of Website Performance
A Holistic View of Website Performance
 
Beating Spam On Your WordPress Website - WordCamp Melbourne 2013
Beating Spam On Your WordPress Website - WordCamp Melbourne 2013Beating Spam On Your WordPress Website - WordCamp Melbourne 2013
Beating Spam On Your WordPress Website - WordCamp Melbourne 2013
 
eCommerce performance, what is it costing you and what can you do about it?
eCommerce performance, what is it costing you and what can you do about it?eCommerce performance, what is it costing you and what can you do about it?
eCommerce performance, what is it costing you and what can you do about it?
 
An introduction to HTTP/2 for SEOs
An introduction to HTTP/2 for SEOsAn introduction to HTTP/2 for SEOs
An introduction to HTTP/2 for SEOs
 
Reducing Server Resources: Improve Costs, SEO, Conversions & UX
Reducing Server Resources: Improve Costs, SEO, Conversions & UXReducing Server Resources: Improve Costs, SEO, Conversions & UX
Reducing Server Resources: Improve Costs, SEO, Conversions & UX
 
Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5
 
High Performance Websites
High Performance WebsitesHigh Performance Websites
High Performance Websites
 
WordPress vs Other Content Management System
WordPress vs Other Content Management SystemWordPress vs Other Content Management System
WordPress vs Other Content Management System
 
Speed Matters!
Speed Matters!Speed Matters!
Speed Matters!
 
Performance in business terms
Performance in business termsPerformance in business terms
Performance in business terms
 
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
 
Securing Your WordPress Website - WordCamp GC 2011
Securing Your WordPress Website - WordCamp GC 2011Securing Your WordPress Website - WordCamp GC 2011
Securing Your WordPress Website - WordCamp GC 2011
 
How to Fix Error 404 in Wordpress
How to Fix Error 404 in WordpressHow to Fix Error 404 in Wordpress
How to Fix Error 404 in Wordpress
 
Site Down: How to Triage Those First Minutes
Site Down: How to Triage Those First MinutesSite Down: How to Triage Those First Minutes
Site Down: How to Triage Those First Minutes
 
4.2. Web analyst fiddler
4.2. Web analyst fiddler4.2. Web analyst fiddler
4.2. Web analyst fiddler
 
London Web Performance Meetup: Performance for mortal companies
London Web Performance Meetup: Performance for mortal companiesLondon Web Performance Meetup: Performance for mortal companies
London Web Performance Meetup: Performance for mortal companies
 

Similar to How to fix 504 Gateway Timeout Error

WordPress Website Down.pdf
WordPress Website Down.pdfWordPress Website Down.pdf
WordPress Website Down.pdfHost It Smart
 
How to fix error 404 not found on word press
How to fix error 404 not found on word pressHow to fix error 404 not found on word press
How to fix error 404 not found on word pressAnny Rathore
 
9 Most Common HTTP Errors Explained
 9 Most Common HTTP Errors Explained 9 Most Common HTTP Errors Explained
9 Most Common HTTP Errors ExplainedAmit Kute
 
Tips for site builders and administrators
Tips for site builders and administratorsTips for site builders and administrators
Tips for site builders and administratorsTim Plummer
 
How to Fix This Site Cant Be Reached the Connection Was Reset.pdf
How to Fix This Site Cant Be Reached the Connection Was Reset.pdfHow to Fix This Site Cant Be Reached the Connection Was Reset.pdf
How to Fix This Site Cant Be Reached the Connection Was Reset.pdfHost It Smart
 
Tips to improve word press security ppt
Tips to improve word press security pptTips to improve word press security ppt
Tips to improve word press security pptCheap SSL Coupon Code
 
WPblog's Ultimate WordPress Guide to Boost Your Website Performance
WPblog's Ultimate WordPress Guide to Boost Your Website Performance WPblog's Ultimate WordPress Guide to Boost Your Website Performance
WPblog's Ultimate WordPress Guide to Boost Your Website Performance Jessica Ervin
 
How to know if your WordPress Website is hacked Get the Inside Story.ppt
How to know if your WordPress Website is hacked Get the Inside Story.pptHow to know if your WordPress Website is hacked Get the Inside Story.ppt
How to know if your WordPress Website is hacked Get the Inside Story.pptSaurabh Srivastava
 
WordPress Resources Nov 2014
WordPress Resources Nov 2014WordPress Resources Nov 2014
WordPress Resources Nov 2014Judy Wilson
 
Wordpress 101 Guide Ebook Free
Wordpress 101 Guide Ebook FreeWordpress 101 Guide Ebook Free
Wordpress 101 Guide Ebook Freehuutienmmo
 
Web Sockets are not Just for Web Browsers
Web Sockets are not Just for Web BrowsersWeb Sockets are not Just for Web Browsers
Web Sockets are not Just for Web Browserscjmyers
 
Apache logs monitoring
Apache logs monitoringApache logs monitoring
Apache logs monitoringUmair Amjad
 
Web Application Development Fundamentals
Web Application Development FundamentalsWeb Application Development Fundamentals
Web Application Development FundamentalsMohammed Makhlouf
 
Shared Hosting and WordPress
Shared Hosting and WordPressShared Hosting and WordPress
Shared Hosting and WordPressAl Davis
 
Component Technologies of E-Commerce
Component Technologies of E-CommerceComponent Technologies of E-Commerce
Component Technologies of E-CommerceSamuel Saunders
 
The Journey of monitoring a WordPress Fleet @Cloudfest 2022
The Journey of monitoring a WordPress Fleet @Cloudfest 2022The Journey of monitoring a WordPress Fleet @Cloudfest 2022
The Journey of monitoring a WordPress Fleet @Cloudfest 2022Plesk
 

Similar to How to fix 504 Gateway Timeout Error (20)

Apache error
Apache errorApache error
Apache error
 
WordPress Website Down.pdf
WordPress Website Down.pdfWordPress Website Down.pdf
WordPress Website Down.pdf
 
How to fix error 404 not found on word press
How to fix error 404 not found on word pressHow to fix error 404 not found on word press
How to fix error 404 not found on word press
 
9 Most Common HTTP Errors Explained
 9 Most Common HTTP Errors Explained 9 Most Common HTTP Errors Explained
9 Most Common HTTP Errors Explained
 
Tips for site builders and administrators
Tips for site builders and administratorsTips for site builders and administrators
Tips for site builders and administrators
 
How to Fix This Site Cant Be Reached the Connection Was Reset.pdf
How to Fix This Site Cant Be Reached the Connection Was Reset.pdfHow to Fix This Site Cant Be Reached the Connection Was Reset.pdf
How to Fix This Site Cant Be Reached the Connection Was Reset.pdf
 
Tips to improve word press security ppt
Tips to improve word press security pptTips to improve word press security ppt
Tips to improve word press security ppt
 
937079
937079937079
937079
 
Class 38
Class 38Class 38
Class 38
 
WPblog's Ultimate WordPress Guide to Boost Your Website Performance
WPblog's Ultimate WordPress Guide to Boost Your Website Performance WPblog's Ultimate WordPress Guide to Boost Your Website Performance
WPblog's Ultimate WordPress Guide to Boost Your Website Performance
 
How to know if your WordPress Website is hacked Get the Inside Story.ppt
How to know if your WordPress Website is hacked Get the Inside Story.pptHow to know if your WordPress Website is hacked Get the Inside Story.ppt
How to know if your WordPress Website is hacked Get the Inside Story.ppt
 
WordPress Resources Nov 2014
WordPress Resources Nov 2014WordPress Resources Nov 2014
WordPress Resources Nov 2014
 
Web tips
Web tipsWeb tips
Web tips
 
Wordpress 101 Guide Ebook Free
Wordpress 101 Guide Ebook FreeWordpress 101 Guide Ebook Free
Wordpress 101 Guide Ebook Free
 
Web Sockets are not Just for Web Browsers
Web Sockets are not Just for Web BrowsersWeb Sockets are not Just for Web Browsers
Web Sockets are not Just for Web Browsers
 
Apache logs monitoring
Apache logs monitoringApache logs monitoring
Apache logs monitoring
 
Web Application Development Fundamentals
Web Application Development FundamentalsWeb Application Development Fundamentals
Web Application Development Fundamentals
 
Shared Hosting and WordPress
Shared Hosting and WordPressShared Hosting and WordPress
Shared Hosting and WordPress
 
Component Technologies of E-Commerce
Component Technologies of E-CommerceComponent Technologies of E-Commerce
Component Technologies of E-Commerce
 
The Journey of monitoring a WordPress Fleet @Cloudfest 2022
The Journey of monitoring a WordPress Fleet @Cloudfest 2022The Journey of monitoring a WordPress Fleet @Cloudfest 2022
The Journey of monitoring a WordPress Fleet @Cloudfest 2022
 

Recently uploaded

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 

Recently uploaded (20)

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 

How to fix 504 Gateway Timeout Error

  • 1. By Aabhas Vijay | WPOven Blog How to fix 504 Gateway Timeout Error on your WordPress Website? 2 January, 2020 There is nothing more annoying than a blank screen with an error message instead of your website’s content. Today, we’ll take a look at the 504 Gateway Timeout Error, and also give some recommendations on how to fix it on your WordPress site. For most blogs and online stores, such errors can lead to loss of revenue. The visitors immediately leave the resource with a bad experience, and cannot make purchases. So let’s dive in – In this article, we will cover – 1. What is the 504 gateway Timeout error? 2. Causes for 504 Gateway Timeout Error? 3. How to fix the 504 gateway timeout error? Search …
  • 2. What is the 504 Gateway Timeout Error? 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. 504 Gateway timeout error is an HTTP status code. It appears when one server does not receive a timely response from another one that works as a gateway or proxy. Simply put, this means that the server could not complete your request within some period. There are many error messages that you might see. Some common errors that you might have encountered: The white death screen Error Establishing a Database Connection Too Many Redirect Error 502 Error Bad gateway As there are a variety of web browsers, operating systems and types of servers, they display the 504 error in many ways. All of them, as a rule, means the same. We listed some of the most popular version: 504 Gateway Timeout 504 Gateway Timeout NGINX NGINX 504 Gateway Timeout Gateway Timeout Error Error 504 HTTP Error 504 Gateway Timeout Error 504 HTTP 504 504 Error Gateway Timeout (504) 504 Gateway Time-out – The server didn’t respond in time Causes for 504 Gateway Timeout Error? Before we consider the error itself, it is important to understand why it appears. Whenever you start your browser and visit a URL, it sends the request back to the server where it is hosted. The web server then processes the request and sends you the requested resources along with an HTTP header. This header contains one of the many HTTP status codes that let you understand whether everything is okay or something went wrong. Not all status codes are bad. For example, the status code 200 indicates that everything works fine.
  • 3. Any status code in the 500-s is error codes (500, 501, 502, 503, 504, etc.) that have different meanings. They indicate that the request was accepted, but the server could not execute it. To that extent, the 504 error means that the server running as a gateway is out of time to wait for a server response. The code is returned when there are two servers involved in processing the request, and the response time from the second server has expired. In addition to server timeouts, there are other causes, leading to 504 error: Slow server. It is possible that the server where you host your WordPress website is responding too slowly, and therefore it generates gateway errors. Insufficient PHP workers. PHP workers are used to running code on your WordPress site. Demanding sites can make all PHP workers busy. In that case, they form the queue. If the queue and the backlog are full, old requests are ignored. You can ask your hosting to increase the number of PHP workers. Additional PHP workers for a site allow executing several requests simultaneously. Problems with the firewall. The firewall on your server may contain errors due to incorrect configuration or rules blocking the connection. Network connection. If there is a problem with the network connection between the proxy server and the webserver, this can lead to delays. Also, there may be network problems with the load balancer, if it is used. How to fix the 504 gateway timeout error? When you see a 504 Gateway timeout error, you might be confused about what to do? You can always try the following actions – 1. Try to reload the page 2. Try a different browser 3. Check on different devices 4. Disable the proxy 5. Check DNS records propagation 6. Temporarily disable the CDN 7. Check the issues with your hosting provider 8. Clean the site from spam, bots and protect it from DDoS attacks 9. Check your plugins and themes 10. Check the logs 11. Change Nginx options Try to reload the page: One of the first things you should do when you face the 504 Gateway Timeout Error is just
  • 4. to wait a minute and reload the page. Perhaps the hosting or server is simply overloaded, and the site will quickly return to work. Another thing you can do is check your website status on downforeveryoneorjustme.com. This site will tell you if the site is out of service only for you or for all visitors. The tool checks the HTTP status code that is returned by the server. If the code differs from 200, then, in this case, you will see the Down pointer. It will mean that the site does not work for everyone. Try a different browser: In case the site is online, but you still see the 504 gateway timeout error, try changing your browser to another one. Clear the browser cache or use the incognito mode, this can also help determine if the error is caused by the browser. Check on different devices: Try opening the site on different computers, on different networks or on mobile devices. If nothing could help to fix the 504 gateway timeout error, this step will help you determine if the problem is on the server side or it is local. Disable the proxy: Sometimes you may get 504 error if you use a proxy server. These cases are very rare, especially on the client-side. Read the guides on how to disable proxy on Windows and Mac. Check DNS records propagation:
  • 5. 504 gateway timeout error is often caused by problems with the DNS server. There are two reasons for that. On the server side, it happens when the domain name is not changed to the correct IP address. If you just moved the WordPress website to a new hosting, it’s important to wait when the address will be added to DNS base. In most cases, it takes up to 24 hours. It all depends on your DNS records TTL value. You can use a free tool like DNSMap to check if your DNS has spread all over the world. The second DNS issue relates to the client side. In this case, you can clear your local DNS cache. This is similar to clearing the browser cache. In Windows, simply open a command line and type the following: You should see the “Successfully flushed the DNS Resolver Cache” message. In macOS, type the following in the terminal: Note: there are no messages of successful operations on Mac. And, finally, you can temporarily change your client DNS servers. By default, DNS servers are provided by your ISP. You can temporarily change them to a public DNS server, for example, provided by Google. Some people prefer to use Google’s public DNS constantly because in some cases they are more reliable. 1 ipconfig / flushdns 1 dscacheutil -flushcache
  • 6. Temporarily disable the CDN: Also, the problem may relate to the content delivery network. If you use a third-party CDN provider, you can try to temporarily disable it. For that, you may use the WordPress plugins. With them, you will be able to disable the CDN safer. If you use the back proxy services like Cloudflare or Sucuri, they may cause the 504 error as they use the additional firewall. Most of them cache 500 state codes when they are returned by your source server. Many users noticed that issue on Cloudflare free plan. Unfortunately, since Cloudflare is a complete proxy service, there is no quick way to disconnect it. However, before blaming the Cloudflare, it is important to know that there are two types of 504 error: 504 Gateway Timeout in Cloudflare (version 1) If you see the page looking like that, then, in this case, the problem is on the Cloudflare side. Contact their user support. Or check their status page. Most likely, they are already notified about this problem and are working on it. 504 Gateway Timeout in Cloudflare (version 2)
  • 7. If you see the page looking like that, then this is a problem with your WordPress hosting. Please follow the recommendations from the next section. Check the issues with your hosting provider: Server problems are one of the common reasons why users experience 504 errors on their WordPress websites. In simple terms, Nginx or Apache wait for a response until the waiting time has expired. 504 errors are really very popular on sites with a lot of visitors and on e-commerce sites and online stores. The latter may have installed e-commerce plugins like Woocommerce. They usually have many non-cached requests. This can cause the server to overload. However, such error can happen to a variety of website types, including the blogs. Many hosters usually offer to upgrade to a more expensive tariff plan to fix this problem. And even if this usually helps to solve this issue, it is often not necessary. Some hosting provide dedicated resources for each server. This means that each site is hosted in its own isolated container. It has all the necessary software resources required to run it (Linux, Nginx, PHP, MySQL). Resources are 100% confidential and do not share with anyone. But some shared WordPress hosting plans do not have this feature. So any neighbouring site with high traffic will cause 504 gateway timeout error on your site. It is also important to note that 504 errors may look very similar to 503 errors (service unavailable) or even 502 errors (bad gateway). But actually, they are different. If you want to prevent such errors in the future, you can use a tool like statuscake.com to track the server state and immediately report any problems. The service periodically sends an HTTP HEAD request to the specified URL. You can simply set your homepage. In addition, you are able to choose the checking frequency from 15 seconds to 10 minutes. The service will send you an email if your site is out of service, indicating the time when it happened.
  • 8. This can be especially useful if you are using a virtual hosting, which, as a rule, is constantly overloaded. This will give you proof that your site did not work (for example, at night). For this reason, we advise you to move on to dedicated hosting. Clean the site from spam, bots and protect it from DDoS attacks: Perhaps your website has been spammed by bots or became a DDoS attack target. Sometimes this leads to uncached requests and, as a result, to server overload. All that results in a 504 gateway timeout error. You can learn the server analytics to see if there are any patterns in it. You can request your hosting provider for this information. The first report, which we recommend studying, is the top-end customers IP addresses. Usually, this is very useful, especially if your site suddenly began to generate large traffic or was attacked by bots. The second report we recommend to look at is the requests and bots. You can quickly compare the number of people visiting your website, with the number of bots. However, remember that not all bots are bad. Google Bot is really a good bot, it scans the site to index the content and promote it in the search engine. The third report we recommend is a cache analysis. Here you can see what requests are missing in the cache, and also what are the top locations of your site. To provide the best performance and stability, you should try to cache as many requests as possible. This is not always available because some resources generate a huge amount of uncached requests. The best example is Woocommerce. These requests are necessary for the correct work and synchronization. If on your site you find and identify traffic or IP addresses that need to be blocked, you can
  • 9. use the WordPress security plugin. However, not all hostings allow you to install security plugins. First, such plugins can influence the performance, especially when they scan the server. Second, the IP blocking feature may not work in them because hosting provider can use load balancers from the Google Cloud Platform. Naturally, IP addresses can always be blocked by the hosting support service. However, depending on how long and large is an attack, this can never end. When the attacks or spam is blocked in one area, they are often switched to other zones, changing IP addresses or using other proxies. Therefore, in this case, we recommend installing a security solution, such as Cloudflare or Sucuri. 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. But, according to many users’ experience, a slow non-cached plugin request can cause the delays, since it uses more of your PHP workers. Once you reach the limit of them, the queue will remove your old requests, which can 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. One of them is the deactivation of all your plugins. Remember that you will not lose your data if you disable them. If you have access to the admin panel, simply go to the Plugins section and select Deactivate feature. This will disable all of your plugins. If this fixes the issue, you need to find its source. Activate the plugins one by one, restarting the site after each activation. Once you see the 504 error, you will be able to identify the problematic plugin. Then you can contact the plugin developer for help or create a ticket in the WordPress repository. If you do not have access to the admin panel, you can use the FTP client to connect to your server. Rename the plugin folder to something like plugins_old. Then check your site again. If this works, you will need to test each plugin separately to find the reason. Rename the plugins’ folder back. Then rename the plugin folders inside until you find the plugin causing the issue. Make sure that all your plugins, themes and the WordPress kernel are updated to the latest version. And make sure that you are using a supported version of PHP. If the plugin contains bad code, then you will most likely need to contact the WordPress developers to solve this problem.
  • 10. Check the logs: You can also use your error logs. One can view them in a special section of the hosting dashboard. You can quickly fix the issue, especially if its source is the website plugin. If your hosting does not offer logging tools, you can add the following code to the wp- config.php file to enable logging: Logs are usually located in /wp-content folder. Sometimes they can be in separate folders. You can also check the Apache and Nginx logs which are most often located at /var/log/apache2/error.log (Apache) or /var/log/nginx/error.log (Nginx) Change Nginx options: If you are maintaining your own server and WordPress website on Nginx+FastCGI (php- fpm). Also, you can use the Nginx as a proxy for Apache. In that case, there are additional settings that you can change to prevent 504 gateway timeout errors. If you are using Nginx with FastCGI (php-fpm), then you need to first make changes to the PHP-FPM file. Go to /etc/php5/fpm/pool.d/www.conf (it can vary depending on the PHP version). Set the following directive: Then you must modify the php.ini file, which is usually located at /etc/php.ini. Find the max_execution_time directive. Increase its value to 300 or create a directive if it does not exist: Finally, you will need to modify the nginx.conf file. Add the following to your Nginx virtual host configuration: Then just restart Nginx and PHP-FPM. If you use Nginx as a proxy for Apache, then in this case add the following to your nginx.conf file: Next, just restart Nginx. 1 2 3 define ('WP_DEBUG', true); define ('WP_DEBUG_LOG', true); define ('WP_DEBUG_DISPLAY', false); 1 request_terminate_timeout = 300 1 max_execution_time = 300 1 2 3 4 5 location ~ .php $ { ... fastcgi_read_timeout 300; ... } 1 2 service nginx reload service php5-fpm reload 1 2 3 4 proxy_connect_timeout 600; proxy_send_timeout 600; proxy_read_timeout 600; send_timeout 600;
  • 11. Contact Support If you constantly face 504 gateway timeout error and nothing helps to fix it, contact the hosting technical support. Try to describe what steps you have taken to identify the error cause and provide as much information as possible. This will greatly speed up the process. Conclusion As you can see, there are many different ways and methods of fix 504 gateway timeout error on the WordPress site. Typically, this is a problem with the server, and in this case you need to contact your hosting to solve them. But it’s important to remember that they can also be caused by third-party plugins or the queue/backlog overflow of your PHP workers. 3 Replies to “How to fix 504 Gateway Timeout Error on your WordPress Website?” 2 9 A P R I L , 2 0 1 9 A T 4 : 3 0 P M Thanks to the excellent manual 3 M A Y , 2 0 1 9 A T 1 0 : 3 0 A M Useful information. Lucky me I discovered your web site unintentionally, and I’m stunned why this twist of fate didn’t happened in advance! I bookmarked it. 1 8 J U N E , 2 0 1 9 A T 4 : 2 7 P M W E B S E R V E R S, W O R D P R E S S E R R O R Reply Reply 1 service nginx reload see here best restauranT around raley
  • 12. Thank you so much for detailing this, I’ve been struggling for weeks with the same problem. Anyway, i am looking for the cheap linux hosting. Can you suggest me the one most cheapest hosting provider? Thank you so much. Leave a Reply Your email address will not be published. Required fields are marked * Comment Name * Email * Website Save my name, email, and website in this browser for the next time I comment. Post Comment P R E V I O U S All You Need to Know About 502 Error Bad Gateway Fed up with your slow WordPress Hosting & sub-par support ? We do things differently at WPOven View Our Plans Reply
  • 13. B r o w s e P a g e Plans & Features Blog Tutorials Free Themes Privacy Policy Take a Tour Knowledge Base Affiliates Refund Policy Terms & Conditions H e l p Contact Us Login Signup Knowledge Base Tutorials R e c e n t P o s t How to fix 504 Gateway Timeout Error on your WordPress Website? All You Need to Know About 502 Error Bad Gateway How to Fix Error 403 Forbidden for WordPress How to Fix DNS_PROBE_FINISHED_NXDOMAIN Error? How To Fix Error 404 Not Found On WordPress Copyright © 2020 WPOven