我在反向代理模式下使用nginx。 这里是configuration文件的相关部分:
server { listen 80; server_name ~^web.redhelper\.ru$ ; access_log off; location /http-bind { proxy_pass http://localhost:7070; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; } }
一段时间后,我开始打500错误。 我认为我正在达到一些最大的开放连接限制。 这里是munin图:


当我使用netstat时,我看到有:
1279 open connections to port 80; (including website itself that is on the same port) of them 745 are in ESTABLISHED state and 479 in TIME_WAIT 277 ESTABLISHED connections from 127.0.0.1:[misc port] to 127.0.0.1:7070 3922 connections from 127.0.0.1:7070 to 127.0.0.1:[misc port] of them 246 are in ESTABLISHED state and 3646 in TIME_WAIT
我认为这是3646个TIME_WAIT连接造成的。 我怎样才能防止nginx拥有这么多的开放连接?
这里是一些更多的图表,也许他们会帮助更好地了解我的问题: http : //munin.redhelper.ru/localdomain/localhost.localdomain/index.html