2

ngnix is not closing the socket after the connection finishes. I've googled and can't come up with anything to will tell nginx to close this connection, other than what I have below: keepalive_timeout 0.

In both the request and response headers, I can see Connection: close, but the socket still sits around in the TIME_WAIT state for about a minute.

tcp        0      0 127.0.0.1:80            127.0.0.1:40345         TIME_WAIT   -

Here are the headers:

Request Headers:
Connection: close
Content-Type: application/x-www-form-urlencoded

Response headers:
HTTP/1.1 200 OK
Server: nginx/0.7.67
Date: Thu, 21 Apr 2011 15:34:31 GMT
Content-Type: text/xml; charset=utf-8
Transfer-Encoding: chunked
Connection: close

Part of my nginx config:

nginx config file:

{
...
        keepalive_timeout 0;
        client_max_body_size 1M;
        fastcgi_read_timeout 60;
        fastcgi_send_timeout 60;

    location ~ \.php$ {
        fastcgi_pass   unix:/tmp/php-fastcgi.sock;
        #fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_intercept_errors on; # to support 404s for PHP files not found
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
        fastcgi_param SERVER_NAME $host;
    }
}
Gryu
  • 499
  • 1
  • 6
  • 14
Jeremy McJunkin
  • 121
  • 1
  • 2

1 Answers1

2

Waiting in TIME_WAIT state for few minutes is by design, please check following links for full description:

http://developerweb.net/viewtopic.php?id=2941 http://www.ssfnet.org/Exchange/tcp/tcpTutorialNotes.html

AlexD
  • 8,747
  • 2
  • 29
  • 38