Why does NGINX report 502 error recently modify a website of the company and add a page. It is OK during offline testing, but 502 & nbsp; Bad & nbsp; Gateway is displayed online. I optimized the code again. The page loading speed was very fast during offline loading, but the loading speed was slow and time-out. Then an error is reported ------ solution ------------ Why does NGINX report a 502 error?
Recently, I modified a website of my company and added a page. Click OK during offline testing, but the 502 Bad Gateway is displayed online.
I optimized the code again. The page loading speed was very fast during offline loading, but the loading speed was slow and time-out. Then an error is reported.
------ Solution --------------------
Solution to 502 bad gateway error
For more information
1. what is error 502 bad gateway?
In short, 502 is the gateway with the error type code bad gateway.
2. cause of error
When the connection times out, we send a request to the server. because the server has too many connections, the server cannot provide a normal response, resulting in such an error.
3. solutions
The best solution is to do it on the server, which is unlikely for everyone.
So what are our solutions?
To put it bluntly, it's easy.
-Refresh (not a general refresh)
Refresh principle: Many people may not know that there are two types of refresh.
The so-called refresh is actually to download data from the server to the local hard disk browser,
Read the data from the local hard disk and show it to the browser.
① Basic refresh: click refresh or use the F5 shortcut key.
Basic refresh only retrieves data from the local hard disk to the browser and does not send a new request to the server.
Most users refresh this frequently and report 502 errors without any effect.
② Refresh from the server: If you click the link of the web page you want to browse again, you will find that the 502 bad getway page is still displayed and can be viewed again now!
Why? When you click the webpage link you want to browse, the data will be re-downloaded from the server.
The solution is to refresh the server: press ctrl + F5 to send a new request to the server.
If the server can respond to you normally, you can see the page.