keepalive_timeout not working?

Sajan Parikh sajan at
Thu Aug 22 18:03:01 UTC 2013

keepalives seem to be working, but the timeout limit I'm setting isn't 
honored it seems..  Someone let me know if I've done something wrong or 
am missing something.

I have nginx installed on Ubuntu from the stable repository at  Nothing has been added, nothing removed.

nginx version: nginx/1.4.2
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx 
--http-log-path=/var/log/nginx/access.log --pid-path=/var/run/ 
--http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx 
--group=nginx --with-http_ssl_module --with-http_realip_module 
--with-http_addition_module --with-http_sub_module 
--with-http_dav_module --with-http_flv_module --with-http_mp4_module 
--with-http_gunzip_module --with-http_gzip_static_module 
--with-http_random_index_module --with-http_secure_link_module 
--with-http_stub_status_module --with-mail --with-mail_ssl_module 
--with-file-aio --with-http_spdy_module --with-cc-opt='-g -O2 
-fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security 
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' 
--with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' --with-ipv6

In my http block, I have the following.

keepalive_timeout  3s;

That is the only place the string 'keepalive' exists.

root at web:/etc# grep -r "keepali" .
grep: ./ No such file or directory
Binary file ./alternatives/rsh matches
Binary file ./alternatives/rlogin matches
./nginx/nginx.conf:        keepalive_timeout  3s;

Yet, when I take a look at netstat -tc, I have waay too many http 
connections in a TIME_WAIT state and they seemingly stay there forever. 
Obviously it's not forever, but it's not closing in 3 seconds.

Sajan Parikh
Owner, Noppix LLC

o: (563) 726-0371
c: (563) 508-3184

More information about the nginx mailing list