How to Fix “504 Gateway Timeout” in WordPress
Last modified: February 4, 2020
A 504 error makes your website inaccessible to users. And, what is really bad news, the problem can appear and disappear on its own. The error occurs when a server can’t connect to an ‘upstream’ server to complete requests.
How this is reported will depend on how your website is configured and hosted.
Here are some ways to fix the issue.
Step One: Reload Your Site
First you need to check that the 504 error wasn’t caused by a glitch in the server. Therefore, wait a few minutes, empty your cache and try loading your site again. If your site reloads, the error might have been solved.
However, if you keep getting the 504 error, there is probably something else that needs to be fixed.
Step Two: Turn Off VPN
If you’re using a VPN to browse the internet, then turn this off. It can sometimes cause you to see a 504 error. If turning it off resolves the problem, contact the provider for support.
Step Three: Turn Off Website Firewall
A DNS level website firewall can sometimes cause the problem. To check this, turn off the firewall and try to reconnect to your website. If this works, speak to your firewall provider. Ask them to give you their list of IP addresses and then give this to your web host so they can whitelist them.
After this, you can turn on your firewall again.
Step Four: Disable Network Proxy
Using a Network Proxy can cause the issue as well. By using a different internet connection you can see if your network proxy is causing the problem. If it is, then you need to disable it and speak to your ISP or network admin to troubleshoot the issue for you.
Step Five: DNS Servers
If the DNS servers you’re using are unavailable due to a fault you might get a 504 error. You need to change your DNS servers to start working. To do this, go to ‘Control Panel’ on PC/laptop then ‘Network and Sharing Center’.
Change your DNS server address to 184.108.40.206 and 220.127.116.11 and apply those changes. If you can visit your website now the problem was with your internet connection. You should speak to your telecoms provider.
Step Six: Clean Up Database
Sometimes you need to clean your database. This isn’t because of anything wrong, just you’ve used it for a long time and it needs reorgnizing. You can use a plugin for this or do it yourself using phpMyAdmin.
Step Seven: Deactivate Any Plugins/Themes
Still getting the 504 error? Then you need to disable all plugins and switch themes. To do this you need to go to the plugins file in your WordPress files, using an FTP client and then change the name of the plugins file to ‘plugins_disable‘. Then immediately rename the file to ‘plugins‘ again.
This will disable all the plugins. Check your website now. It should display, but it will not have many of the features.
You can do the same with the themes.
If you notice your website is back on and displaying, it is a plugin/theme causing a problem. You can switch them on, one at a time, to find out which one is cause the problem. You can do this in the dashboard.
Final Word: Don’t Let Simple Errors Take Down Your Website
Ensure that your website isn’t down for too long. Learn how to fix errors like this yourself. Don’t rely on developers. The best thing about WordPress is that anyone can master it.