Are you seeing 502 Bad Gateway Error in your WordPress site? 502 bad gateway error occurs when your website could connect to your web hosting server. In this tutorial you will learn how to fix 502 bad gateway error in your WordPress blog.
Cause of 502 Bad Gateway Error
The cause of this error is the connection interrupted between your website and the website hosting server. When you visit your website your web browser sent request to the web hosting server and if your web hosting server takes too long to respond you will see 502 bad gateway error.
Fix 502 Bad Gateway Error
Since there are number of reasons that your website is throwing 502 bad gateway error, you have to try different troubleshooting method until it get fixed.
- Step-1: Reload your Blog.
- Step-2: Clear Browser Cache.
- Step-3: Deactivate All the Plugins.
- Step-4: Disable Content Delivery Network (CDN) or Firewalls.
- Step-4: Check with Website Hosting Provider.
Step-1: Reload your Blog
One of the reason can be the high volume of traffic that your website receives which your web hosting server could not handle it and returns 502 bad gateway error. In this case this error generally won’t last long, if you reload your blog after few minutes the error may disappear. If you still see the error then you have to follow the steps below.
Step-2: Clear Browser Cache
Sometimes even the error get fixed, your web browser may show error from the cache. You need to clear the browser cache and see whether the error got fixed or still exist.
If you are using Google Chrome, click on three dot button customize and control Google Chrome at the top right corner of the screen. From the More tools, click on Clear browsing data.
Now, you will see dialog box where you have to select All time from the drop-down box in Time range option then click on clear data button.
This will clear the cache from your web browser and your can reload your website to see, if the error got fixed. If this does not fix the error then follow the next steps.
Step-3: Deactivate All the Plugins
Some faulty plugins can be another reason that cause 502 bad gateway error in your WordPress website. You can deactivate all the installed plugins renaming the plugins folder that is located in root directory using FTP Client FileZilla.
Connect FileZilla to your web server and double click on root directory e.g. public_html folder where you will see wp-content folder.
Open wp-content folder, inside the folder you will find plugins folder where all your installed plugins are located. Right click on the plugins folder and click on rename then change the default name to any name e.g. plugins-fix. These will deactivate all the installed plugins in your WordPress blog.
You can see the detailed guide on How to disable all the WordPress plugins.
After deactivating, reload your site, if you didn’t see any error then you know the issue is cause by one of the plugins which need to be remove or replace.
To find out the faulty plugin, first you need to rename the plugins folder e.g. plugins.fix to default name e.g. plugins. Once done you will be able to see the plugins in the WordPress Dashboard.
Login to WordPress dashboard and activate the plugin one by one until you see the error. Once you find out the faulty plugin that breaks your site you need to remove or replace it from your blog.
Step-4: Disable CDN or Firewalls
This error can also occurs due to the Content Delivery Network (CDN) or Firewalls enabled in your website. If your website is using CDN or Firewalls such as Cloudflare then you need to disable it for temporary and point your website to the web server directly .
If the error get fixed after disabling the CDN or firewalls then you know the CDN or firewalls is creating the issue. You can contact your CDN or Firewalls providers for support to resolve the issue from their end.
Step-4: Check Web Hosting Provider
If the error still exists after troubleshooting above methods then you should contact your hosting provider to fix the issue at their end. If your website is hosted with best WordPress hosting companies then they will response you immediately and help you to fix the issue.
We hope this guide on how to fix 502 bad gateway error in WordPress blog is helpful. If you find this guide helpful, Please share and follow us on facebook and twitter.