When visiting a website that uses Nginx you get this 502 error:
502 Bad Gateway
NGINX
The 502 Bad Gateway, NGINX error means that the gateway is unable to send the webpage to the browser.
To troubleshoot the 502 Bad Gateway error, we know that the Nginx web server received a request from the browser because it was able to respond saying that it is an Nginx web server. Therefore the issue is most likely on the web server end, rather than the web browser / client.
To fix the 502 Bad Gateway error, troubleshoot the Nginx server end – check that there isn’t a router issue (try resetting your router if the Nginx web server can’t serve any websites). Try contacting your ISP to make sure their internet caching system hasn’t failed.
If the error is only occurring on one website, in addition to the above try clearing your browser cache.
If you own the website with the error, there is probably an issue with the communication between your NGINX web server and your router – hence the 502 error suggesting that it can’t serve the webpage. Check your Nginx server and router’s IP settings and contact your ISP to check that they don’t have a cache problem.