Share the solution for nginx 502

Let me talk about the environment first:

A windows machine, only ran nginx, acting as a proxy.

A Linux server, lnmp environment, running a php website.

Acting on the nginx of windows, the relevant parameters of the nginx.conf configuration file are not adjusted. The first day ran very normal, the next day there was 502, direct hosts bound linux server ip access without any problems.

I believe that most people will not suspect that the problem lies in the Linux server. After all, there is no problem in binding hosts directly. So, tossing on windows for a long time, whether you restart the nginx service or restart the system, or 502.

Check the error log of the nginx error log on windows and find a lot of "[error] 2420#2560: *27 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream"

This kind of log is rare, but you can determine that the problem is on the Linux server. So open the error log to the Linux server, but unfortunately did not find any problems.

Go search google, and did not find a good solution.

Fortunately, I have encountered a similar problem many years ago, but the Linux agent linux, the symptoms and the problem are basically similar, the solution at that time is to modify the worker_connections parameter in the nginx.conf configuration file of the linux server nginx.conf. The value of the time, remembered to be 51200, changed to 4096 is ok.

Go to the linux server, open the nginx configuration file, and find that the worker_connections turned out to be 51200. After changing to 4096, restart the nginx service.

Surprise reappears, the problem is solved!

After the solution, I thought: I should adjust the level of the error log to debug on the Linux server, you can see more information.

Because it is the customer's machine, there is no need to toss.

Share the solution for nginx 502

Encoder

Optical Rotary Sensor,Custom Encoder,Optical Encoder 6Mm Shaft,Handwheel Pulse Generator

Jilin Lander Intelligent Technology Co., Ltd , https://www.jilinlandermotor.com

This entry was posted in on