Problem): I encountered this problem and prompted in the log: wsarecv() failed (10054: an existing connection was forcefully closed by the remote host) while reading response header from upstream.Please advice from the master for the solution, thank you.
Configuration): some of my configurations are as follows:
worker_ processes 2;
error_ log logs/error_ 2.log warn;
pid logs/nginx. pid;
events {
worker_ connections 1024;
}
http {
include mime. types;
resolver 8.8.8.8;
default_ type application/octet-stream;
rewrite_ log on;
access_ log logs/access_ 2.log main;
sendfile on;
underscores_ in_ headers on;
keepalive_ timeout 65;
... others
server{
... others
location /jd/ {
lua_ need_ request_ body on;
default_ type 'text/html';
error_ log logs/error_ 3.log warn;
lua_ code_ cache on;
rewrite_ by_ lua_ file cooperoplua/jumpserver. lua;
}
location @jump_ proxy {
proxy_ pass $uri;
proxy_ http_ version 1.1;
proxy_ set_ header Upgrade $http_ upgrade;
proxy_ set_ header Connection $connection_ upgrade;
# proxy_ set_ header Connection "upgrade";
# proxy_ set_ header Connection keep-alive;
proxy_ set_ header Host $host:$server_ port;
proxy_ set_ header X-Real-IP $remote_ addr;
proxy_ set_ header X-Forwarded-For $proxy_ add_ x_ forwarded_ for;
expires 0d;
}
}
}
Try):I've tried some methods, such as ` keepalive_ requests 500;`; Or "worker_connections: 4096;" And other methods. However, there is no effect, and the prompt is still: wsarecv() failed (10054: an existing connection was forcefully closed by the remote host) while reading response header from upstream, but only one host has a problem, the other hosts are good, and there is no problem on my local host.