我有一个使用Jersey SSE的java webapp,当我直接连接到我的tomcat实例时,CLOSE_WAIT连接的no:不会增长。(用cURL验证)
当我通过nginx反向代理时,与SSE调用相关的连接不断增长(在CLOSE_WAIT中),最后服务器进程阻塞,需要重新启动。鉴于以下是我的配置,我猜nginx每60秒关闭一次连接,然后为下一个SSE请求创建一个新连接,任何想法如何解决这个问题?
upstream tomcat {
server 192.168.10.101:8443;
server 192.168.10.102:8443;
keepalive 16;
}
server {
listen 443 ssl;
#server_name 192.168.10.100;
server_name myserver.home.net;
ssl_certificate /opt/mount/config/certs/test_ssl.pem;
ssl_certificate_key /opt/mount/config/certs/test_ssl_cert.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers RC4:HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
keepalive_timeout 180s;
location / {
proxy_pass https://tomcat/mydashboard/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Connection "";
chunked_transfer_encoding off;
proxy_cookie_domain ~(.*)$ ws1.home.net;
rewrite ^/dashboard/(.*)$ /$1 last;
}
}
答案 0 :(得分:0)
对于遇到此问题的人,请将以下内容添加到位置部分。
proxy_read_timeout 7200;