使用nginx代理,端口8000。tomcat用于后端服务器,端口8080。nginx的error.log中报如下错误:
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"
解决步骤:
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"/>
2.修改nginx的nginx.conf文件,配置信息如下:
http{}中添加:
keepalive_requests 8192;
keepalive_timeout 180s 180s;
server{
location / {
proxy_http_version 1.1;
}
}
参考文档:https://blog.csdn.net/meiguopai1/article/details/78801446