Performance tuning
Global · server
integer · seconds
proxy_keepalive_sec
Keep-alive duration for pooled upstream (origin) connections.
- Config key
proxy_keepalive_sec- Scope
- Global · server
- Type
- integer · seconds
- Default
120
How long the proxy keeps an idle connection to an origin open for reuse. Reusing warm upstream connections skips the TCP+TLS handshake on subsequent requests — a meaningful latency win for busy backends.
⚡Match your origin
Set this at or below your origin's own keep-alive so the proxy doesn't try to reuse a connection the backend has already closed.
proxy_keepalive_sec = 120