502 Error Bad Gateway error is a very frustrating server error that is related to WordPress, Nginx, HTTP, and PHP. In this guide, we are going to share how to fix 502 Bad Gateway issues.
Read on to know why you see this nginx 502 bad gateway PHP error and how you can fix it.
- What is The 502 Bad Gateway Error?
- WordPress 502 Error Bad Gateway
- Why we face 502 Bad Gateway Nginx Error?
- How to Fix 502 Bad Gateway issues
- Try Another Browser
- Clear Browser Cache and Cookies
- Fix 1: Reload the webpage
- Fix 2: Check for server connectivity issues
- Fix 3: Check DNS changes
- Fix 4: Fix firewall configurations
- Fix 5: Check and fix website bugs
- Fix 6: Contact your hosting provider
- Fix 7: Disable Cloudflare
- Fix 8: Restart Networking Devices
- Fix 9: Change your DNS Servers
- More Error related to 502 Bad Gateway Easyengine WordPress
- More on 502 Bad Gateway Error
What is The 502 Bad Gateway Error?
If you are a web developer or server admin, you know what 502 webserver error is. But many users are still don’t know about it. HTTP 502 server error is a standard error that comes from the server-side, and there is nothing you can do locally on your PC. This error indicates that there are some issues with the server. You will face this problem on any device.
Sometimes just refreshing the page will work, but for many users, the problem can persist for days. There are many reasons for this 504 gateway time out error, including server overload, old browser, PHP error, and more. You can wait for 10 minutes to fix the issue automatically by the server. If not and you are the admin of the website, then you have to perform some tasks on your server.
WordPress 502 Error Bad Gateway
If you are facing a 502 bad gateway Nginx error with your WordPress site, then there are many possible reasons and errors, including the white screen of death or the establishing a database connection error. WordPress websites with Cloudflare are more likely to face this unfortunate gateway error.
Why we face 502 Bad Gateway Nginx Error?
Whenever you open or try to access any website, it sends a request to the webserver. Then the server receives the request and sends requested data with HTTP header and HTTP status code.
If something goes wrong with this process, you will face this error codes 500, 501, 502, 503, 504, 520, etc. So after waiting for a long time and refreshing the web page, the only option is to fix the issue from the server-side.
- HTTP Error 502 Bad Gateway
- HTTP 502
- 502 Service Temporarily Overloaded
- Temporary Error (502)
- 502 Server Error: The server encountered a temporary error and could not complete your request
- 502 Bad Gateway Nginx
- bad gateway Cloudflare
- 502 proxy error
How to Fix 502 Bad Gateway issues
When it comes to broken webpages, 502 errors are perhaps the most difficult to solve. All of these error codes are related to the server end of a connection.
However, there are multiple causes of a 502 error, and thus fixing it can be a time-consuming process. Below are some working methods to fix the issue on Windows and Mac computers.
Try Another Browser
Chances are high that you are facing this bad gateway error with one particular browser. Try to access the website in other browsers like Firefox, Microsoft Edge, Opera, and Safari.
Clear Browser Cache and Cookies
The 502 web server error is most likely to appear due to browser cache and cookies. Removing these files could solve the problem. You can delete cache and cookies from the settings of related browsers.
Fix 1: Reload the webpage
The first and instant solution is to reload the page using F5 on your keyboard or using the refresh button on your browser.
Before you dive deep into the technical part, reload the page. Wait for 1 or 2 min and then perform hard reload. Clear cookies and data on that website and try again.
If that doesn’t work, move on to the next solution.
Fix 2: Check for server connectivity issues
If your website is hosted on shared hosting or third party hosting, then it is most likely to face such an issue. Many times they shut down the servers due to maintenance.
The only way to troubleshoot this error is to wait for the server to go up again after maintenance.
Fix 3: Check DNS changes
Most of the users are facing this 502 bad gateway WordPress error after changing host servers or changing IP address. Make sure that it will take 24 hours to reflect DNS changes.
Fix 4: Fix firewall configurations
Firewall can also cause this 502 gateway time out problem. Sometimes bad firewall configuration is stopping the response from the server, and the result is 502 Bad Gateway Error. So check your firewall settings and make sure that they are correct. Also, disable firewalls and check if you are accessing the website or not.
Fix 5: Check and fix website bugs
Make sure that your website is bug-free. Also, check the SSL certificate is working fine.
Fix 6: Contact your hosting provider
If nothing works and you are still facing the issue, then the last option is to contact your hosting provider. Contact them and explain the issue. They can check the issue and fix it.
Fix 7: Disable Cloudflare
If you are website is using Cloudflare middleware then you should disable it for some time. After disabling, restart your server and then check the issue.
Fix 8: Restart Networking Devices
Try to restart your Modem and Routers and then try again. Also, reboot your PC. You can also try to open the website in private tabs.
Fix 9: Change your DNS Servers
You can use Google’s free DNS servers to fix 502 proxy error.
Step 1 – Go to your network and internet settings from the control panel.
Step 2 – Go to Network and Sharing Center and then click on adapter settings from the left pane.
Step 3 – Then, right-click on the ethernet and choose properties.
Step 4: Find IPv4 and go to properties.
Step 5: Follow the image and enter Google DNS address which are:
Save settings, and it’s done. Reboot PC and recheck the website.
If you are using Easyengine for WordPress installation and facing this issue then you can easily fix this problem.
All you have to do is just log in to your server using putty and then disable the website using “ee site techniedges.com disable“.
Wait for 10 seconds and then enter this code – “ee site techniedges.com enable“. This should fix the issue.
More on 502 Bad Gateway Error
We have shared all possible solutions to fix the issue related to serer, browser, cache, cookies and DNS Server. If you are still facing the same issue again and again then try to contact your hosting provider as we mentioned above.
You can always contact us for any issue related to Windows, WordPress, and Networking. Contact us on Facebook (@techniedges).