The nginx-tcp-keepalive module of Nicolas Viennot provides family of tcp_keep* directives that are location level. This module should work properly on modern Linux and BSD systems. Mac OS X support is limited to tcp_keepalive only. The module was originally releases approximately in the moment when nginx gained the so_keepalive option. I hadn't tried if the module is still compatible with newer version of nginx.
You have 2 options:
so_keepalive
nginx optionnginx-tcp-keepalive
module directiveslisten ... so_keepalive=on
listen
directive withso_keepalive
option isserver
level. See http://nginx.org/en/docs/http/ngx_http_core_module.html#listen for full documentation. This option is available since 2011-12-12 in nginx 1.1.11 and later.tcp_keepalive=on
The nginx-tcp-keepalive module of Nicolas Viennot provides family of
tcp_keep*
directives that arelocation
level. This module should work properly on modern Linux and BSD systems. Mac OS X support is limited totcp_keepalive
only. The module was originally releases approximately in the moment when nginx gained theso_keepalive
option. I hadn't tried if the module is still compatible with newer version of nginx.Made it: https://github.com/nviennot/nginx-tcp-keepalive
At the moment, only mail proxy module supports "so_keepalive" directive.
There is as LD_PRELOAD module that turns keepalives on, even if the app doesn't have an option to do so. (I don't know if it works with nginx or not.)