Worried about 504 gateway timeout error in your WordPress website?. Don’t panic, We will explain to you how to resolve the 504 gateway timeout error in WordPress website. This error makes your website inaccessible to the customers. This error arises when a server is unable to connect an upstream server to end up the request.
What is 504 Gateway Timeout Error?
Table of Contents
504 gateway timeout is an HTTP status code that one server did not receive a timely response from another server when trying to load a web page or it was unable to complete a request. The exact meaning is that “the server, acting as a gateway, timed out waiting for another server to respond.” In simple, it is unable to connect to the server in a given time frame. This 504 error is universal, it can appear to any browser or to any operating system. Any HTTP status code, that begins with the digit 5 is a server-side error. This error message can be displayed in many ways such as Gateway Timeout Error, HTTP Error 504, HTTP Error 504 – Gateway Timeout, 504 Gateway Time-out. The server didn’t respond in time etc. There are certain reasons, that the server fails to respond such as:
- Your domain is inaccessible
- A problem with your proxy settings
- Problems with your hosting provider
- An issue with your Content Delivery Network (CDN)
Often 504 error will be removed when you clear cache, cookies, and reload your WordPress website. But if it doesn’t work, there are several reasons that a server takes too long time to respond. In this post, we will let you know the possible ways to fix the 504 gateway timeout error in WordPress website.
Ways to Fix 504 Gateway Timeout Error in WordPress:
Refresh the Page
Most of the times the 504 error may be temporary. The first and foremost step is that just wait and see for a few seconds and then reload the page and see. This may happen if the server is unloaded and unable to respond. If that the case, once you refresh the page, the issue will be resolved.
Try Using the Different Browser
If the page doesn’t open with the default browser, then try using the different browser and check if it works. In case if it works with the other browser, then clear your browser cache in your default browser or you can try using incognito mode to access the page.
Flush out DNS
The step you can try out and see is by flushing out the DNS server. If the DNS server you might be utilizing is down, or if you are unable to reach the website, then you may get a 504 error. In that case, try using different DNS servers and check. Flushing DNS may vary based on your operating system. In windows, move to the command prompt and use the command “ipconfig/flushdns” in order to clear the DNS resolver cache on your computer. Wait for few seconds and see, you will receive a confirmation message like “Successfully flushed the DNS resolver cache”. Then in Linux, in order to flush DNS, open the terminal and execute the command “ sudo/etc/init.d/nscd reset”. Then in order to flush DNS in Mac OS, it depends based upon their versions. The commands for each Mac OS versions are
- Mac OS Sierra:sudo killall -HUP mDNSResponder
- Mac OS X Yosemite: sudo discoveryutil udnsflushcaches
- Mac OS X Mountain Lion: sudo killall -HUP mDNSResponder
- Mac OS X Lion: sudo killall -HUP mDNSResponder
- Mac OS X Mavericks: sudo killall -HUP mDNSResponder
- Mac OS X Snow Leopard: sudo dscacheutil -flushcache
- Mac OS X Leopard and below: sudo lookupd -flushcache
- Mac OS X El Capitan: sudo killall -HUP mDNSResponder
Try these commands for your different OS to clear the DNS resolver cache.
Test with Different Devices
By checking to access the webpage with different devices, may let you whether the issues are with a local issue or a server-side problem. You can try loading the website with a different computer, mobile device or a network connection.
Check your Plugins and Disable
There are much fewer issues that the plugins and themes causing 504 error. If you give much effort to the WordPress plugins, then there is a chance for 504 error. Or the plugins may be incompatible or outdated to cause the problem. In order to resolve this, you have to disable all the plugins installed on your WordPress website. In order to disable the plugins, and if you don’t have access to the admin panel, then you can use the FTP to connect to the server. Then rename the plugin folder to something else like plugin_used. Once done, check that if the website works. If this works, then you have to test each and every plugin to know which one is the problematic plugin. By chance, if there is any problem with the plugin, remove that plugin and rename the plugin folder. One point to remember is that, keep all your plugins and themes up to date in order to overcome this problem.
Check Error Log
The 504 error may also occur due to any recent updates or changes in the website. You can check the error logs for a timeout in PHP files and check if everything is fine. To do this, you can edit your wp-config.php files by adding the below codes:
define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_LOG’, true );
define( ‘WP_DEBUG_DISPLAY’, false );
Once you have added this, you can see all the logs in the wp-contents/debug.log file. Moreover, to edit the wp-config.php, you have to log in to your cPanel or FTP and check for the files.
If you are using CDN to serve faster, then there are chances to get 504 error. In order to find if there is a problem with the CDN, then try temporarily disabling the CDN to see if the issue is resolved. Then if the problem is exactly with CDN, contact with the service provider and explain them the issue. They will work on it and resolve the issue for you.
Check to Host Provider
There are chances that you may get 504 error due to the hosting provider. In case your hosting plan, wouldn’t be suitable for your needs or if there is too much load on it. In that case, you can contact the hosting provider and convey the issue you faced. Or a good hosting provider will email if you have an issue in your website. They may work on it or instruct you to resolve it.
Check Proxy Settings
This is a rare case of checking your proxy settings. Check whether you are using the proxy through your browser, which may fail to connect to your server. In order to fix the error if it is really caused due to the proxy, in the case of Chrome, go to the setting and click on the advanced tab. Once you scroll down you will find a system tab and below that, you will find open proxy settings option. If you click on to it, you will find a popup window with a LAN settings button. Once you click on the button, you will find the checkboxes with “Automatically detects settings”, “Use automatic configuration script”. Check if both the options are enabled. If it is enabled, try disabling it and save the settings. Now refresh the browser and visit the website again and see if it issue is resolved.
Clean up your WordPress Database
Due to the failure of the WordPress database may result in 504 error. Though WordPress is safe handling your database, it is important to keep them updated and regular backup of your database is a must. In order to prevent the loss of data in a database. There are numerous plugins to backup your database, use any one of them and make sure you have a database backup. It is also must to clean up your database regularly.
Change your DNS Server
DNS server helps you to connect your computer to connect to the different servers on the internet. At rare cases, you may get 504 error if your DNS server may be unable to connect to your website. In that case, you can try changing the DNS server and check if it is working. Settings may differ based on the OS. For windows, move to Control Panel > Networks and Sharing Centre. There for example, if your DNS server address is 220.127.116.11, then you can change them to 18.104.22.168 and click on apply changes. Now trying visiting the website and check if it displayed. Once you are out of 504 error, then this is the solution. And for Mac, you can move to Settings > Network. Click on the Advanced tab and then click on the DNS tab and make the changes and check.
Turn off VPN
At times you may use the VPN server to browse the web. Your VPN server may not be able to get any response from the hosting server. In that case, you will be able to face 504 error. If so, try disabling the VPN server and check if the website is displayed. If you are able to view the website, then the problem is due to your VPN server. If you feel like using the VPN server, then you can go for some other good VPN server or you can contact your VPN service provider to resolve the issue.
504 gateway timeout error is the most common issue. This error may be faced by almost all the website users. If none of the above methods works, then it is good to contact any website support team to resolve your issue. We have listed the most common issues that cause the 504 error. If you come across with any other method, please comment us. Hope you got ways to fix the 504 gateway timeout error in WordPress. If you have any queries please feel free to comment us. You can subscribe to us at Facebook and Twitter.