On TCP connections held by NGinx, can it be configured to send TCP Keepalive
(Not HTTP KeepAlive!)
On TCP connections held by NGinx, can it be configured to send TCP Keepalive
(Not HTTP KeepAlive!)
You have 2 options:
so_keepalive
nginx optionnginx-tcp-keepalive
module directiveslisten
directive with so_keepalive
option is server
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.
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.
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.)