1 / 13

How to fix 504 Gateway Timeout Error on your WordPress Website?

There is nothing more annoying than a blank screen with an error message instead of your websiteu2019s content.

Télécharger la présentation

How to fix 504 Gateway Timeout Error on your WordPress Website?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WPOven Blog Search … How to fix 504 Gateway Timeout Error on your WordPress Website? By Aabhas Vijay | 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?

  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: 1 ipconfig / flushdns You should see the “Successfully flushed the DNS Resolver Cache” message. In macOS, type the following in the terminal: 1 dscacheutil -flushcache 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.

  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: 1 2 3 define ('WP_DEBUG', true); define ('WP_DEBUG_LOG', true); define ('WP_DEBUG_DISPLAY', false); 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: 1 request_terminate_timeout = 300 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: 1 max_execution_time = 300 Finally, you will need to modify the nginx.conf file. Add the following to your Nginx virtual host configuration: 1 2 3 4 5 location ~ .php $ { ... fastcgi_read_timeout 300; ... } Then just restart Nginx and PHP-FPM. 1 2 service nginx reload service php5-fpm reload If you use Nginx as a proxy for Apache, then in this case add the following to your nginx.conf file: 1 2 3 4 proxy_connect_timeout 600; proxy_send_timeout 600; proxy_read_timeout 600; send_timeout 600; Next, just restart Nginx.

  11. 1 service nginx reload 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. W E B S W E O R R V D E R P R S E S S E R R O R , 3 Replies to “How to fix 504 Gateway Timeout Error on your WordPress Website?” see here 2 9 A P R I L , 2 0 1 9 A T 4 : 3 0 P M Thanks to the excellent manual Reply best restauranT around 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. Reply raley 1 8 J U N E , 2 0 1 9 A T 4 : 2 7 P M

  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. Reply 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 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 View Our Plans

  13. B r o w s e P a g e H e l p R e c e n t P o s t Take a Tour How to fix 504 Gateway Timeout Error on Plans & Features Contact Us Knowledge Base your WordPress Website? Blog Login Affiliates All You Need to Know About 502 Error Bad Tutorials Signup Refund Policy Gateway Free Themes Knowledge Base Terms & Conditions How to Fix Error 403 Forbidden for Privacy Policy Tutorials WordPress How to Fix DNS_PROBE_FINISHED_NXDOMAIN Error? How To Fix Error 404 Not Found On WordPress Copyright © 2020 WPOven

More Related