Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using nginx as reverse proxy with varnish in the background. I have LAMP fueling varnish. The problem I am seeing on Varnish server is that the connection from nginx is getting established everytime a request is served.

We are serving more than 300 req/second and we see something like:

netstat -an|awk '/tcp/ {print $6}'|sort|uniq -c
      1 FIN_WAIT1
      7 LISTEN
      1 SYN_RECV
  43187 TIME_WAIT

This is ofcourse undesired. What would be best is that we setup a tunnel or a connection between nginx and varnish ones and all communication happen over that static connection. I am not quite sure how exactly this can be done or if there are better ways to do it.

What else can I do here?


share|improve this question
Please post all the relate configuration files. – quanta Oct 12 '11 at 23:25
Please describe what is so "undesired" about the situation. That's just how nginx works; if it's not causing you direct problems, don't worry about it. – womble Oct 13 '11 at 1:27
up vote 1 down vote accepted

Nginx only supports HTTP/1.0 between itself and back-end servers, so no HTTP keep-alive by default :(

There are a lot of weird and wonderful third-party modules which may help, but so far I've only found keepalive support for memcache and redis, no HTTP

share|improve this answer
Nginx now supports upstream keep-alive as of 1.1.4 – David Radcliffe Oct 3 '14 at 17:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.