I'm using nginx in reverse-proxy mode. Here's relevant part of config file:

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;


After some some time I started to hit 500 error. I think that I'm hitting some max open connections limit. Here's munin graph:

enter image description here enter image description here

When I use netstat I see that there are:

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[misc port] to
3922 connections from to[misc port]
of them 246 are in ESTABLISHED state and 3646 in TIME_WAIT 

I think that it is 3646 TIME_WAIT connections causing this. How can I prevent nginx from holding that much open connections?

Here are some more munin graphs, maybe they will help to better understand my problem: http://munin.redhelper.ru/localdomain/localhost.localdomain/index.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.