使用nginx代理,端口8000。tomcat用于后端服务器,端口8080。nginx的error.log中报以下错误:html
2018/09/21 09:08:06 [error] 12488#11600: *27 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading upstream, client: 192.168.11.234, server: 192.168.11.234, request: "POST /kjdp_login HTTP/1.1", upstream: "http://192.168.11.234:8080/login", host: "192.168.11.234:8000", referrer: "http://192.168.11.234:8000/xxxx/yyyy/zzzz.html"nginx
解决步骤:apache
1.修改tomcat的server.xml配置。配置信息以下:后端
<Executor name="tomcatThreadPool" namePrefix="req-exec-"
maxThreads="2048"
maxHttpHeaderSize="8192"
minSpareThreads="512"
maxSpareThreads="1024"
maxIdleTime="30000"/>
<Connector executor="tomcatThreadPool"
port="8080"
protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="10000"
redirectPort="8443"
acceptCount="1024"
enableLookups="false"
URIEncoding="utf-8"
compression="on"/>tomcat
2.修改nginx的nginx.conf文件,配置信息以下:服务器
http{}中添加:url
keepalive_requests 8192;
keepalive_timeout 180s 180s;.net
server{代理
location / {server
proxy_http_version 1.1;
}
}
参考文档:https://blog.csdn.net/meiguopai1/article/details/78801446