Many times we can browse the web and find a 502 bad gateway error at Nginx. There are a few reasons why you will find this message in your webserver log, and here we will teach you how to fix it.
What is a 502 Bad Gateway Error?
Your browser sends a request to a web server any time you visit a website. The web server receives the request and handles it before returning the requested services.
The request was approved, but the server refused to fulfil it, resulting in a 502 bad gateway error. A 502 bad gateway error means that one server has received an invalid response from an inbound server when serving as a gateway or proxy in this case
Before delving into all of these possibilities, keep in mind that, You must comprehend the meaning of the 502 Bad Gateway error message. So, the problem is an HTTP Status Code error, which occurs at the gateway. What is a gateway, anyway? In simple terms, a gateway is similar to an access point or a bridge that connects one infrastructure to another; in this case, the gateway may be a service or application that is up and running and accepting requests from the Nginx web server.
Nginx as Proxy for Apache: The gateway in this case is Apache. When you use Nginx as an Apache proxy, if Apache dies or isn’t configured properly, you could get a 502 Bad Gateway error.
How to Fix the 502 Bad Gateway Error? (step by step)
A 502 bad gateway error usually indicates a network/host problem, we’ll try to resolve it at the server end/root stage.
Follow below steps to fix 502 Bad Gateway Error:
- Step::1 Log on WHM(Root)
- Step::2 Select Service Status
- Step::3 Now check for httpd service status
- Step::4 Restart Apache(httpd) from Easy Apache4
- Step::4 Select Apache4 and uninstall and install any module
Uninstallation and installation process will bring back the Apache in functional mode.
You can also restart Apache using SSH and a command similar to the one below.
service httpd restart
Hope this article helped you.. Thanks for reading this post !!!
If you’re looking for cheap web hosting. Please Contact to MEGA ACS HOST. Shared web hosting started at ₹ 399/Year.
Mega ACS Host: Website:- https://www.megaacshost.com/
Follow Us social media
Facebook Page– https://www.facebook.com/megaacshost/
Twitter Page– https://www.twitter.com/megaacshost