nginx 10054報錯問題解決方案


使用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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM