应该从 Nginx 配置中删除 `keepalive_timeout` 吗?

Bry*_*son 14 nginx keepalive

哪个是更好的配置/优化:明确限制keepalive_timeout或允许 Nginx 自行终止保活连接?

我看到了关于keepalive_timeoutNginx 指令的两个相互矛盾的建议。它们如下:

# How long to allow each connection to stay idle; longer values are better
# for each individual client, particularly for SSL, but means that worker
# connections are tied up longer. (Default: 65)
keepalive_timeout  20;
Run Code Online (Sandbox Code Playgroud)

# You should remove keepalive_timeout from your formula.
# Nginx closes keepalive connections when the
# worker_connections limit is reached.
Run Code Online (Sandbox Code Playgroud)

Nginx的 文档keepalive_timeout没有提及自动查杀,而我只看到这一建议一次,但它令我着迷。

该服务器专门为TLS 安全连接提供服务,所有未加密的连接都会立即重新路由到https://相同 URL的版本。

VBa*_*art 12

当达到 worker_connections 限制时,Nginx 关闭 keepalive 连接。

确实如此。

  • 那么什么配置比较好呢? (6认同)