Errors are as undesirable as a speeding ticket. Both can be paid for but you will regret what they cost you. When it comes to your WordPress website, an error like 504 Gateway timeout may seem to be a nightmare. You are not able to browse your webpage. And it does seem there is nothing you can do. Well, there are a few things you can definitely try out. This easy guide can help you fix 504 Gateway Timeout error for your WordPress website.
What is 504 Gateway Timeout Error?
A 504 Gateway Timeout Error simply means that one server did not receive a timely response from another server. One of these servers acts as a gateway and could not fulfill your request within a given time frame.
The Error can be displayed in different variations like these:
504 Gateway Timeout nginx
504 Gateway Timeout
Gateway Timeout Error
HTTP Error 504
504 Gateway Timeout – the server didn’t respond in time
HTTP Error 504 – Gateway Timeout
Gateway Timeout (504)
NGINX 504 Gateway Timeout
Let us now see how we can fix this error.
1. Wait and Refresh
Sometimes things aren’t as permanent as we think them to be. This also applies to errors. The 504 Gateway Timeout error you are facing might be a temporary one. There might be an increase in your website traffic or the server is utilizing more resources, who can really predict?
The simplest solution is to wait for some time and try refreshing the web page. While you wait you can visit https://downforeveryoneorjustme.com and check if the site is down for everyone or it is just you who is facing the problem.
Sometimes it can just be a temporary issue and you will be able to access the web page if it is so. If not, you are up for troubleshooting using the following fixes in this tutorial.
2. Check if the issue is Browser Related
Sometimes, the browser can give an error. The only way to be sure is to switch the browser and see if you are still getting the error. If you don’t get the error while using other browsers then you can be sure that the issue is with the particular browser.
Try clearing browser cache. Follow this quick tutorial about how to clear browser cache.
You can try using incognito mode.
Also, try deleting cookies for the website you are visiting.
Here is how you can delete site cookies in Google Chrome.
Go to Settings>> Advanced>> Privacy and Security
Select the “Site Settings” option.
In the Site Settings screen, click on “Cookies”
The Cookies screen will appear. Select “See all cookies and site data”
Once you click the option, a list of sites will appear. Select your site and delete cookies.
3. Restart Network Devices
Sometimes a hardware issue can cause the error. There can be a problem with your modem, router, switches and other networking devices.
Restart all network devices and see if the error is resolved.
4. Disable VPN
Sometimes VPN servers are not able to get a response from the server that is hosting your site. If you are using a VPN, try disabling it.
If you are able to access your website after turning off the VPN, you can be sure that VPN was the source of the problem. You can try switching to another VPN or stop using it altogether.
5. Check Proxy Settings
When there are errors in the proxy settings, you may face problem connecting with the server. Check your proxy settings if they are correct.
You can also disable proxy.
Here is how you can do it in Google Chrome.
Go to Settings>>Advanced>>> System
Click “open proxy setting”. A dialog box will appear.
Go to “Connections” and click on “LAN settings”
You will see a checkbox for “Proxy server”. Uncheck it and hit OK.
6. Flush DNS Cache
A) On Windows
To flush the DNS cache, run Command Prompt as an administrator in Windows. You need to enter the following commands:
netsh int ip set dns
netsh winsock reset
These commands should be entered one at a time and press enter after each command. This process renews the IP address. This may resolve the 504 Gateway Timeout error.
B) On Mac
- Launch the Terminal App. You can find it in Applications>>Utilities>> Terminal
- Copy the following command in Terminal and hit enter
sudo killall -HUP mDNSResponder; sleep 2;
Once you enter your password, your DNS cache will be cleared.
7. Use Google’s DNS
Sometimes the DNS you are using may throw 504 error. You can try switching to Google’s DNS. The following steps explain how you can do this on Windows and Mac.
A) On Windows
You can use Google’s DNS if your DNS settings are causing the problem. Here is how you can do that.
- Type R key while holding Win Key. (Win+R combination) This will open the Run Program.
- Type “Control Panel” and hit “OK” to open Control Panel
3. In the Control Panel, choose View>>Small Icons
4. In the next screen, Click “Network and Sharing Center”
5. Click on “Change adapter settings”
6. Right click on the network you are using, and click Properties
7. Click on “Internet Protocol Version 4 (TCP/IPv4)” and click on Properties.
8. In the “Use the following DNS addresses” section, Enter:
Preferred DNS Server: 126.96.36.199
Alternate DNS Server: 188.8.131.52
Click OK and now you are using Google’s DNS. This will solve the problem in most cases. If it does, enjoy browsing. If it doesn’t, go to the next step in this tutorial.
B) On Mac
- In System Preferences, Choose “Network”
2. Select the network for which you want to change DNS. Click on “Advanced”
3. To add DNS server click on the + button.
4. Add 184.108.40.206 and 220.127.116.11 as Google’s DNS server
8. Deactivate Plugins
If a plugin is making too many requests to the server, it may trigger a 504 Gateway Timeout error. In such a scenario, you can try deactivating all plugins and see if the error goes away.
In case you can access the admin area of your WordPress site, you can manually deactivate each plugin.
If you are not able to access the WordPress admin area, then you can connect to your site using an FTP client.
Once you are connected, go to the wp-content folder. In that folder, there is a folder named “Plugins”. To deactivate the plugins on your site, simply rename the folder to something else. For example, you can rename the folder as “Plugins_old”.
Once your plugins are deactivated, you can see if the site is working without any error. If the error is resolved then you can be sure that one of the plugins was the cause of the error. You can narrow down the culprit by activating each plugin one-by-one and checking the error at the same time.
If your web host supports WP CLI then you can deactivate all the plugins without having to access the plugins folder. Nestify’s Managed WordPress Hosting supports WP-CLI.
9. Tweak VPS Settings
If you are using VPS, you can tweak server settings to increase specific resource limits. This can resolve the 504 Gateway Timeout Error.
Here you can do it on Apache and Nginx Servers.
In the httpd.conf file, add the following line
In the php.ini file, add the following line
In /etc/nginx/conf.d/timeout.conf file change the values to the following:
Edit the php.ini file and add to it the following line:
10. Server Issue
Web servers can face timeouts due to server load. There can be other issues with the server. For Example,
- Limited PHP Workers: PHP workers execute the code on your WordPress website. When the load increases, it may require more PHP workers than assigned.
- Firewall issues: The firewall on the server may have been misconfigured or have some errors with the rules that can prevent the connection from establishing properly
- Network Connectivity: Problems in network connectivity can cause a delay in responding to HTTP requests. This can lead to 504 Gateway Timeout errors.
- Slow Server: The server itself can be slow. Thus, it may not be able to respond within a specific time frame.
There is little you can do with server issues. Contact your web host to resolve the problem. Depending on the response, you might consider changing your host for a better one.
11. Cloudflare Errors
If you are using a CDN solution like Cloudflare, you may get 504 Gateway Timeout error in certain scenarios.
With Cloudflare, you may expect two kinds of error pages.
An error page like the following means that the issue is with Cloudflare side. In this case, you should contact Cloudflare support.
On the other hand, an error page like the following means the issue is with your hosting provider. In this case, you should contact your web host.
12. Reach Out To Your Web Host
If none of the above steps work out for you then this is the time to reach out to your host. You are paying for hosting and you deserve your problems to be solved by your web host.
So these were the common ways to deal with the 504 Gateway Timeout error. We hope some of these fixes do work for you. Have you found another fix? Do let us know in the comments. We love the discussion.