Error 504 Gateway timeout is one of the most common HTTP 5xx errors faced by website owners and website visitors. For many WordPress blogs and e-commerce platforms, it is important to know how to correct such server errors so that their high-income visitors will not be allowed to visit competing websites.
Because the 504 Gateway Timeout error does not tell you why it happened, it is difficult to determine what caused it when the server crashes. This article will help you understand it in detail, understand how to determine the cause, and then correct it.
After trying all the different solutions outlined in the post, your website should be up and running immediately.
It sounds pretty good? Let's go in!
Do you want to watch the video version?
contents
1. 504 What is the gateway timeout error?
2. How to fix 504 error timeout gateway
3. Other HTTP errors, such as 504 gateway timeout
Error 504 Gateway timeout is one of the most common HTTP 5xx errors encountered by website owners and website visitors.
What is a 504 gateway clock error?
Every time you visit a website in a browser, the browser sends a request to the web server where the website is located. The provider requests and responds to the requested resource.
How HTTP requests and responses work.
The server response contains one of many HTTP status codes that determine the status of the browser's response. But all these HTTP status codes are incorrect. For example, the status code 200 OK means that the server has successfully processed the request and means "everything is normal."
HTTP status codes like 5xx indicate that the server has a problem, the server knows about it, and it cannot satisfy the client request. Therefore, they are also referred to as Server 5xx status codes.
Officially, five status codes (500, 501, 502, 503, 504) are assigned under the 5xx category. You can also encounter many informal codes (506, 507, 509, 520, etc.).
The Internet Engineering Task Force (IETF) detected the error 504 Gateway Timeout as follows:
The status code 504 (gateway timeout) specifies that the server did not receive the timely response required to complete the request from the server when acting as a gateway or proxy.
To simplify this further, this error occurs when two providers participate in the request process. The first server (usually the main server) terminates and waits for a response from the second server (top server).
Error 504 Gateway timeout manifests itself in many ways. The following are some common display methods:
"HTTP Error 504" in Google Chrome.
Error 504 Gateway Timeout is similar to error 502 Bad Gateway, it means that the first server received an invalid response from the second server (the server above).
Status code "504 GATEWAY TIMEOUT" in Chrome DevTools.
Version 504 gateway timeout error
The browser itself will display a 504 Gateway Timeout error, just like any other error. Because there are different operating systems, web servers, browsers, and user representatives, it can appear in many ways.
Here are some common 504 error message versions that you can access:
• 504 gateway timeout
• 504 NGINX Timeout Gateway
• NGINX 504 gateway timeout
• Bad timeout gateway
• Error 504
• HTTP 504 error
• HTTP 504 error-gateway time
HTTP 504
• 504 error
• Gateway timeout (504)
• This page is invalid-domain response time is too long
• 504 Gateway timeout-provider did not respond in time
• Blank white curtains
Although all the above error responses are expressed in different ways, they all indicate the same 504 gateway timeout server error.
Providers and websites can customize the way that 504 gateway timeout errors are displayed to users. Some of them may be interesting! This is a good strategy to break the despair of guests.
GitHub specific HTTP 504 error page.
Bandora SEO 504 gateway timeout error
All 5xx errors will prevent you from loading the site, thereby harming the user experience. Therefore, search engines like Google will take these errors seriously. If the error persists for a long time, it may also cause the site to be removed from search engine results.
For example, when Google spiders encounter a 503 invalid service error, they will realize that this is a temporary problem because it is often used to activate website maintenance mode. In this way, they will try to search the page again later.
The 504 gateway timeout error does not need to be temporary, as it can be due to a variety of reasons. If your website crashes for a few seconds, and the spider tries to track it several times each time, it will try to cache the page. They won't even notice it.
But if your site crashes in more than 6 hours or more, Google will treat the 504 error as a serious problem for the entire site, and you need to correct it as soon as possible. This may have a negative impact on your SEO.
Detect errors in Google Search Console
Google Search Console is one of the best SEO tools for tracking HTTP 504 errors on your website.
Causes a 504 gateway timeout error
Since the 504 error persists for a while between servers, the problem may not lie with the client device or the Internet connection. It also includes your tools and communications.
The error 504 Gateway Timeout means that the Web server waited too long for another server to respond and "timed out." There may be many reasons for this period: other servers are not working properly, overloaded or crashed.
Another server does not always need to be external (eg CDN, API gateway). It can also be a server-like organization within the main Web server (such as a proxy server, a database server).
How to correct 504 gateway clock error
If you don’t know the complete details of your WordPress site, such as its server configuration, hosting plans, third-party plugins, and the traffic it crashed, you may find correcting the 504 gateway timeout error frustrating and stressful.
With so many variables involved, I suggest that you correct very rare client-side problems first, and then continue to correct server problems. They usually make 504 errors.
Try to reload the website
When you encounter a 504 gateway timeout error, the first thing you can do is wait a few seconds and try to reload the page.
You can use the F5 keyboard shortcut to refresh/reload web pages in most browsers. To clear the page browser cache before updating, you can press CTRL + F5 instead.
Update website in Chrome browser
In the meantime, you can also try to load the site in a different browser to fix it as a problem. Since most 504 errors are due to loading a temporary server, using this solution should restore your site to normal.
If waiting and reloading the site does not resolve the 504 error, you can check whether the site has been downloaded for everyone or just for you. There are two useful online tools that can be used to test website downtime, for everyone to use or just for me, is this true?
Atakdomain.com tested on Down for anyone or just me
Restart your network tool
Sometimes, problems with network devices such as modems or routers can cause a 504 gateway timeout error. Restarting these devices can help you solve the problem.
Although you can turn on all these network devices in any order, the command to restore them is important. Usually, these tools are opened from the "outside to the inside", and use your primary client device to connect to the Internet service provider as instructed.
Check your proxy settings
The proxy server is located between your device and the Internet. It is commonly used to increase online privacy by hiding private information (such as device location) from websites and web servers (such as using VPN).
Although a proxy server rarely causes a 504 error, incorrect proxy server settings can sometimes cause it. You can disable the proxy server and try reloading the web page to see if it corrects the error.
Change "Proxy" settings in Windows 10
Most clients do not use a proxy server, so if you are not sure whether to use a proxy server, you can skip this step. However, you may have installed it without your knowledge. I suggest you check the proxy settings of your device and browser to eliminate this cause.
DNS issues
The 504 gateway timeout error may also be caused by DNS problems on the server side or the client side (or both).
The most likely cause of server DNS problems is that the FQDN (fully valid domain name) did not respond to the correct IP address or the DNS server did not respond. Usually, this happens when you move your WordPress site to a new server or host. Therefore, it is important to wait for the domain DNS records to be fully deployed, which can take up to 24 hours.
You can use free tools such as whatsmydns.net DNS Checker or DNSMap to check whether your DNS is distributed all over the world.
Control DNS allocation for your domain on whatsmydns.net
To correct customer DNS issues, you can try to clear the local DNS cache. This is like clearing the browser cache, except here, you are clearing the DNS cache from the operating system.
If you are running Windows, you can clear the DNS cache by opening a command prompt and entering the following path:
ipconfig /flushdns
Use the command prompt in Windows to clear the DNS cache
You should see "DNS resolver cache wiped successfully." Whether the message is valid.
For the latest version of macOS, you can open a terminal and run the following command:
Sudo killall -HUP mDNSResponder
After the process is complete, you will not see any information in macOS, but you can modify it by adding commands to the custom message.
Sudo killall -HUP mDNSResponder; successfully cleared DNS cache
If you are using an older version of macOS, the commands you need to enter depend on the version of macOS you are running. For more information, you can check the macOS section of Atakdomain's in-depth DNS category.
If you are using the Linux operating system, the process is very similar to macOS, because the Linux version also uses the terminal as the command line medium. Since there are so many Linux distributions, the exact command you need to run may vary from one partition to another. For more information, you can refer to the Atakdomain guide.
Finally, you can temporarily change the client DNS server. Specifically, your ISP will automatically detect your DNS server. But you can temporarily change these in the public DNS IP.
Some trusted DNS servers you can try are Google Public DNS, Cloudflare 1.1.1.1, Quad9 DNS, and Cisco OpenDNS.
Configure a custom DNS server in Windows 10
Temporarily disable the CDN of your website
Sometimes, there may be problems with your content delivery network (CDN). If the origin server cannot access the site, most CDNs will try to provide web page caching from their own cache.
But most CDNs do not enable this feature by default because it is complicated to hide dynamic attributes on many sites (such as the WordPress management dashboard).
Install the "Cache Everything" page rule in Cloudflare
A straightforward solution to this problem is to temporarily disable your CDN. For example, if you use the free WordPress CDN Enabler plugin to link your web page to the CDN URL, you can disable the plugin and try to reload your website.
Do the same for any other plugins used to connect to the CDN (e.g. WP Rocket, Breeze, W3 Total Cache).
If you cannot access the admin panel of your website, you can disable the plugin by specifying the name of the plugin folder via SFTP.Disable all extensions of SFTP by renaming the attachment folder
CDNs like Cloudflare or Sucuri provide full proxy functions with additional clicks between your mouth server and your origin server. Therefore, you often encounter HTTP 5xx errors when using them. Most of them cache the 5xx errors returned by your origin server, so they are easy to fix.
Cloudflare’s free plans often cause 5xx errors. Unfortunately, since it is a perfect proxy feature, there is no quick way to disable it. But before you blame Cloudflare for this, please know that Cloudflare shows two versions of the 504 gateway timeout error.
504 gateway time in Cloudflare (variant 1)
When the origin server of your site responds with a standard HTTP 504 response, Cloudflare will display a custom 504 gateway timeout error screen.
Cloudflare error 504 custom screen
Here, the problem is your web server and not Cloudflare. You can try other solutions listed below or contact your hosting provider for technical assistance.
504 Gateway Time in Cloudflare (Variant 2)
If Cloudflare causes a 504 gateway timeout error, the error screen will display "cloudflare", which is now the standard server name for all Cloudflare assets. Generally, the error screen will look like this:
504 gateway timeout error screen created by Cloudflare
Since Cloudflare itself is not responding, you won’t see an error screen called Cloudflare here.
Most likely, Cloudflare is aware of this problem and is already working to fix it. You can confirm this by checking the Cloudflare System Status website. Alternatively, you can contact Cloudflare support for a faster solution.
Check Cloudflare system status at cloudflarestatus.com
Due to heavy load, the 504 gateway time in Cloudflare
The size of the upload to the site may also be the cause of server downtime. Cloudflare limits the file upload size (based on HTTP POST requests) for free and professional plans to only 100 MB.
Cloudflare's "maximum lift size" limits for different plans
The problem may be at the end of your host or Cloudflare. You can find out the real reason why Cloudflare traversed your DNS host file and tried to upload again.
If you use Cloudflare with WordPress, I suggest you use their free plugin and remove key URLs from the cache (such as the WordPress admin dashboard). You can find more information on how to configure Cloudflare settings for WordPress in the detailed Atakdomain post.
Recommended reading: How to install Cloudflare APO for WordPress.
Server problem (please consult your host)
Server issues are one of the most common reasons for facing 504 gateway timeout errors. Since most WordPress sites are hosted on Nginx or Apache web servers, Nginx or Apache is waiting for a response for a certain period of time.
Many customers who address this issue will not encounter Atakdomain on other WordPress hosts. The speech is like this:
We have approximately 100,000 visitors every month and more than 200,000 page views. So far, we have used ____ hosting, and due to constant server load, we have seen a 504 error. I don’t like the way ____ handles the problem, and was told that we will be forced to implement their specific plan in the near future. I don’t think this is necessary.
Due to server congestion, mobile and e-commerce sites are more likely to receive 504 errors because they create too many inactive requests. However, this problem can be solved with any website, even simple web pages. Many landlords will ask you to update the advanced plan to solve the problem, which is unnecessary in most cases.
Atakdomain uses LXD to host hosting and organizes LXC software containers for each site. In this way, each WordPress site is implemented in its own independent container and can access all the software (Linux, Nginx, PHP, MySQL) needed to run it. Resources are 100% confidential and will not be shared with any other websites, including yours.
Most WordPress hosts that offer shared hosting plans do not have this feature. Therefore, a website hosted on the same server as your website may cause your website to receive a 504 error.
In addition to separating each site into its own container, Atakdomain also designed its infrastructure to easily manage thousands of simultaneous links. Atakdomain hosts the MySQL database on the local host, not a remote server. This means there is no delay between machines, which speeds up investigations and reduces the chance of time passing.
Many customers who migrate to Atakdomain find that public transportation time is greatly reduced.
The performance of C2 is improved by 212.5% after conversion.
Overloaded servers are not the only reason for server downtime. There can be many other reasons for the 504 error:
Slow server infrastructure
The server you are using to host your WordPress site may not have enough resources to handle the load. It's like modern video games with graphically challenging toys on the PC for decades.
The server is just trying to provide services to the site. The only solution to this problem is to upgrade the server to a better infrastructure. Therefore, Atakdomain's most basic WordPress hosting plan will also run a static site with medium traffic.
Need more PHP worksheets
The PHP workspace is used to execute your WordPress site code. An e-commerce website with 50,000 visitors per month requires more resources than a simple blog with the same traffic. If all the PHP employees of the server are busy, they will create a queue.
When the queue is too large, the server does not listen to old requests, causing the server to throw a 504 gateway error. You can ask the landlord to increase the number of PHP staff. This will enable your site to meet many requirements at the same time.
Firewall problem
Your server wall may have some errors or incorrect configuration. Perhaps a few lines will not allow the server to establish the correct connection. You can check if your server has error logs to determine if there is a problem with your wall.
Network connection problem
Communication problems between the proxy server and the web server may cause delays in response to HTTP requests. If you use a load balancer, it may also have network connectivity issues.
HTTP time
When the connection between the Web server and the client remains open for a long time, a connection between HTTP occurs. For WordPress sites, this usually happens when running a WordPress import. One way to solve this problem is to switch to a faster Internet connection.
You can also use tools that support WP-CLI to run text directly on the server, bypassing the HTTP connection completely. For example, you can use the wp import WP-CLI command to run the WordPress Importer plugin directly through the command line interface.
Important note: 504 Gateway Time error is similar to 503 Unsuccessful Business Errors or 502 Bad Door error. But they are all different. If you encounter a 504 error in Atakdomain, please open a support ticket to correct your problem immediately.
You can use tools like updown.io to track when your website is downloaded manually. It will periodically check its status by sending HTTP requests to your site (or any URL). You can set the control frequency from 15 seconds to 1 hour. If your site does not respond correctly, it will notify you via email or SMS.
Use updown.io to easily track your website
You will get free points for each updown.io account, but if you are looking for a cheaper alternative, you can check WebGazer or UptimeRobot. Both of these tools will help you track your website time every 5 hours for free. This is reasonable enough for most website owners.
WebGazer website monitoring tool list
Monitoring your website will give you an idea of how often it fails. This is especially useful if you use a shared hosting provider. Most WordPress hosts that run this feature will automatically get this information from you. Therefore, it is always recommended to go with them.
For a more detailed explanation, see the importance of managing WordPress hosting in the Atakdomain post.
Spam, bots or DDoS attacks
Malicious attackers can crawl your web server by sending too many and/or resource-intensive requests. If your site is spam sent by bots or is attacked by DDoS, it may crash your server and cause many real users to have 504 gateway timeout errors.
You can check server traffic and analysis to see if you can find any irregular templates in site traffic. If you use Atakdomain to host your website, you can easily view this data by going to the MyAtakdomain analytics dashboard.
MyAtakdomain analysis tab
Start your investigation by looking at the customer IP above. It will let you know who made the most requests and where. If your server suddenly runs out of bandwidth or runs a lot of traffic, then this report will be very useful.
Find "Top Customer IP" in MyAtakdomain Dashboard
Next, you can view the cache analysis report. Here, you can see how many requests passed through the cache or were missed, or served from the cache. For performance and convenience reasons, you may want to cache as many requests as possible, but this is not always possible.
For example, the WooCommerce website generates a large number of unsolicited requests for functions such as shopping carts and transaction processing.
The ‘Cache Analysis’ screen in MyAtakdomain
Finally, you can use the WordPress security plugin to improve the security of your site by detecting and blocking malicious traffic/IP. You can also ask your host to block some IPs.
Struggling with ongoing problems with WordPress? Atakdomain is a hosting solution built on performance and security! View our plan
Depending on the length and scale of the attack, this can be a tedious process of extorting IP, because many attackers have changed their IP and proxy addresses after being blocked.
Note: Atakdomain does not allow its customers to install WordPress security plugins because they can have a huge impact on the performance of the site, especially its monitoring features. Since Atakdomain uses Google Cloud Platform's load balancing, blocking IP does not always work as expected.
You can use special security solutions such as Cloudflare or Sucuri to protect your website from DDoS attacks and spam bots. For more information, you can check the Atakdomain article on how to install Cloudflare on your WordPress site and how Sucuri can help stop DDoS attacks.
Bad WordPress database
Sometimes, the 504 gateway timeout error may be caused by a database error, especially in a WordPress website. Usually, this is due to a damaged table or database file. Sometimes, it can also cause serious security issues, such as hacking your website or database.
Repairing the damaged WordPress database is related to this issue. Plug-ins such as WP-DBManager can easily diagnose and repair database problems. I suggest you read Atakdomain's comprehensive guide on fixing WordPress database issues to get started.
View your website plugins and themes
In most cases, third-party plugins and themes will not cause 504 errors. But they are unlikely to cause server downtime, and are usually related to many unsolicited requests made by plugins/themes. Since it connects too many PHP employees to your server, it can cause a 504 error at most.
An important example of this problem is WooCommerce, which is an installation of plugins to enhance e-commerce features on WordPress sites.
The easiest way to solve this problem is to disable all plugins. Remember, if you only disable one plugin, you will not lose data.
If you can access the admin panel, you can go to the add-ons screen, select Disable from the pop-up menu, show all add-ons, and click the Apply button. This will disable all your plugins.
Do not disconnect all WordPress plugins through the WP admin panel
If you cannot access the management area, you can disable the add-on via SFTP using the specified method. Simply rename the main attachment folder to disable all attachments.
After disabling all plugins, make sure your website loads correctly. If it works, you need to activate each plug-in. After activating each plug-in, test the site.
Finally, make sure that your WordPress plugins, themes, and themes are up to date. Also, please make sure that your server is running the recommended version of PHP.
If you think this is too much, you can always ask your landlord for help. Atakdomain uses New Relic and other parsing technologies to help consumers narrow down the scope of add-ons, questions, or text that may cause errors.
In the worst case, such as unsolicited issues or error codes in plugins/themes, you can bring in WordPress developers to solve the problem.
Check the error log
When resolving and fixing 504 errors on WordPress sites, it is useful to look up the error log. This can help you quickly fix problems on the site, especially when it contains request plugins on the site.
If you are a Atakdomain customer, you can easily see the error in the login screen of the MyAtakdomain dashboard.
Check the error log in the MyAtakdomain dashboard
If your host does not have a login tool, then you can enable the WordPress debug mode and add the following code to the wp-config.php file:
Definition ('WP_DEBUG', true);
Definition ('WP_DEBUG_LOG', correct);
Definition ('WP_DEBUG_DISPLAY', error);
Continue WP_DEBUG to enable or disable WordPress debug mode. They have two consecutive optional partners that can expand their capabilities. The extension WP_DEBUG_LOG allows all errors to be saved in the /wp-content/ directory of the debug.log file. If you don’t see this file, you can create one at any time.
WP_DEBUG_DISPLAY continuously checks whether the error log is displayed on the HTML page. Reporting this error will hide all errors, but you can evaluate the error later because you also set WP_DEBUG_LOG to correct.
Important note: If you enable WP_DEBUG in the Atakdomain environment, it will detect all errors in the debug.log file instead of the error.log in the MyAtakdomain dashboard.
You can also download the original WordPress error log file via SFTP. Generally, you can find the error log in a folder named "logs" in the server root folder.
Use SFTP to access the WordPress error log folder
Atakdomain users can also enable WordPress debug mode from their MyAtakdomain dashboard. To do this, go to Site> Tools> Debug WordPress and click the Enable button. This will allow you to view PHP errors and warnings without having to use SSH or SFTP to enable debug mode.
Finally, you can check the server log file. Depending on the server you use to host your WordPress site, they usually appear in the following areas:
• Apache: /var/log/apache2/error.log/
• Nginx: /var/log/nginx/error.log/
For more information, please refer to Apache or Nginx login related documents.
Regularly adjust Apache or Nginx settings
You can modify the server configuration file to increase the resource limit of a specific route. This may help you resolve the 504 gateway timeout error.
For Apache web server
First, add the following code to your httpd.conf:
Timeout 600
This setting specifies when the server waits for certain requests before they show up as a network time issue. Its default value is 60 seconds (Apache version 2.4).
You can only add this path in the httpd.conf file, not in the .htaccess file. Since most shared hosting servers do not allow you to modify the httpd.conf file, you can instead add the LimitRequestBody directory value to your .htaccess file.
Then add the following line to your php.ini file:
Maximum execution time 300
The default value of the PHP max_execution_time guide is 30 seconds. Adding it will make the PHP text of your website run longer.
For Nginx web server
If you run a WordPress website on Nginx + FastCGI Process Manager (PHP-FPM) or use Nginx as a reverse proxy for Apache, you can change the server settings to prevent 504 gateway timeout errors.
504 Door Time Error in Nginx + FastCGI (PHP-FPM)
First, you need to modify the PHP-FPM pool configuration file. You can find it in /etc/php7.4/fpm/pool.d/www.conf on the Nginx server (the actual path may vary depending on the PHP version). Alternatively, you can run the following command in the terminal to modify the PHP-FPM pool configuration file:
Sudo Nano /etc/php/7.2/fpm/pool.d/www.conf
Next, install the following guide:
request_terminate_timeout = 300
After that, you need to modify the php.ini file. You can find it in /etc/php.ini. Open the file and add/modify the value of 300_seconds max_execution_time within 300 seconds.
Maximum execution time = 300
Finally, add the following code in the nginx.conf file space block:
location ~ .php$ {
...
fastcgi_read_timeout 300;
}
Restart Nginx and PHP-FPM to make the conversion more efficient.
Reload the sudo nginx function
Reload the sudo php7.4-fpm utility
The actual PHP-FPM reload code will vary based on the version of PHP installed on your server. Test your website to see if it solves the problem.
504 Gateway time error on Nginx proxy
If you use Nginx as Apache's reverse proxy server, you can make the server time smoother by adding the following path to the nginx.conf file:
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;