HTTP upstream directives
keepalive directive (HTTP upstream)
Upstream context. Limits idle cached connections per worker, not active connections. Since 1.29.7 the documented default is 32 local; local is new in that version. Older releases require explicit enablement.
Formal Syntax & Structure
nginx syntaxnginx
keepalive connections [local];Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| connections | integer | Idle cached upstream connections per worker, not total connections. Modern zero disables cache. |
| local | literal local | New in 1.29.7; restrict cache reuse across locations. Modern default 32 local. |
Working Example
Example Snippetnginx
keepalive 8;