Nginx502 errors are caused by problems with backend servers in proxy mode. These errors are not nginx problems, so you must find the cause from the backend! However, nginx has put all these errors on its own, which makes nginx promoters highly questionable. After all, we can understand the word badgateway? Isn't it badnginx?
There are many causes of nginx 502 errors because of problems with backend servers in proxy mode. These errors are not nginx problems, so you must find the cause from the backend! However, nginx has put all these errors on its own, which makes it highly questionable for nginx promoters. After all, we can understand the word "bad gateway? Isn't it bad nginx? People who do not know it will directly put the responsibility on nginx. I hope the next version of nginx will make the error prompt slightly more friendly, at least it's not a simple 502 Bad Gateway statement, and I don't forget to attach my name to it.
The most common occurrence of 502 errors is that the backend host is on the machine. In the upsTrIn the eam configuration, there is such a configuration: proxy_nExT_upstream: This configuration specifies the error that nginx will go to the next backend host when retrieving data from a backend host. The default value is error.TimeAn out or error occurs when a machine or disconnection occurs, and a timeout is a read congestion timeout, which is easy to understand. I generally write all of them:
Proxy_next_upstream error timeout invalId_ Header http_500 http_503;
However, now I may want to remove the http_500 option. When http_500 specifies that the backend will return a 500 error, it will convert it to a host. If the backend jsp fails, a bunch of stacktrace error messages will be printed, it is now replaced by 502. But programmers in the company do not think so. They think that nginx has encountered an error. I really don't have time to explain the 502 principle to them ......
Invalid_header I didn't take it into account, and I also wanted to get it down first.
503 error can be retained, because the backend is usually apache resin. If apache crashes, it is error, but resin crashes, it is only 503, so it is necessary to keep it.
I am not using nginx fastcgi much now.