6

In official Nginx docs a new directive added since v1.19.10 named keepalive_time 1h: Nginx keepalive_time Doc

Limits the maximum time during which requests can be processed through one keep-alive connection. After this time is reached, the connection is closed following the subsequent request processing.

Once a keep-alive connection initiates by browser, keepalive_timeout 75s limits the time during witch the next static HTTP request could be sent. After 75s, the keep-alive connection will be terminated. Now my question is, what will be happened after keepalive_time 1h? The connection already closed after 75 seconds! Does this mean that Nginx can execute a request witch has sent in a keep-alive connection for 1 hour?

Please simply describe the differences with an example as much as possible.

Mohamad Reza
  • 61
  • 1
  • 1
  • 2

1 Answers1

7

keepalive_timeout is the time where the server will keep an idle connection open. If you send a request and then do nothing on this connection, the server will shutdown the connection at 75s after your previous request. keepalive_time is the maximum duration where a connection can be kept open even if it is not idle. So, if your connection is idle (no requests are sent), the server will shut it down after 75s (keepalive_timeout). If your connection is not idle (you keep sending requests), the server will shut it down after 1 hour (keepalive_time).