使用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{}中添加:.net
keepalive_requests 8192;
keepalive_timeout 180s 180s;代理
server{server
location / {xml
proxy_http_version 1.1;
}
}
參考文檔:https://blog.csdn.net/meiguopai1/article/details/78801446