nginx连接tomcat长连接配置

1、nginx配置


一、upstream配置修改

upstream api.boss.letv.com {

         server 127.0.0.1:8084;

         server 10.100.54.150:8084 max_fails=2 fail_timeout=5s backup;

keepalive 64;

}

 

二、localtion 配置修改

        location / {

            proxy_pass  http://api.boss.letv.com;

                       proxy_http_version 1.1;

                 proxy_set_header Connection "";

            proxy_set_header Host $host;

            proxy_set_header X-Real-IP $remote_addr;

            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        }

       

 

三、tomcat配置

<Connector port="8084" executor="tomcatThreadPool" 

                protocol="org.apache.coyote.http11.Http11NioProtocol"

                maxHttpHeaderSize="8192"

                maxThreads="1000"

                                maxConnections="20000"

                minSpareThreads="100"

                enableLookups="false"

                compression="on"

                compressionMinSize="2048"

                compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain"

                connectionTimeout="20000"

                                asyncTimeout="600000"

                URIEncoding="UTF-8"

                acceptCount="1000"

                redirectPort="8443"

                keepAliveTimeout="60000"

                maxKeepAliveRequests=”1000000”

                disableUploadTimeout="true"/>

相关推荐