admin管理员组

文章数量:1531257

2024年7月3日发(作者:)

nginx常用的超时配置说明

client_header_timeout

语法 client_header_timeout time

默认值 60s

上下文 http server

说明 指定等待client发送一个请求头的超时时间(例如:GET / HTTP/1.1).仅当在

一次read中,没有收到请求头,才会算成超时。如果在超时时间内,client没发送任何东

西,nginx返回HTTP状态码408(“Request timed out”)

client_body_timeout

语法 client_body_timeout time

默认值 60s

上下文 http server location

说明 该指令设置请求体(request body)的读超时时间。仅当在一次readstep中,

没有得到请求体,就会设为超时。超时后,nginx返回HTTP状态码408(“Request timed

out”)

keepalive_timeout

语法 keepalive_timeout timeout [ header_timeout ]

默认值 75s

上下文 http server location

说明 第一个参数指定了与client的keep-alive连接超时时间。服务器将会在这个时

间后关闭连接。可选的第二个参数指定了在响应头Keep-Alive: timeout=time中的time

值。这个头能够让一些浏览器主动关闭连接,这样服务器就不必要去关闭连接了。没有这

个参数,nginx不会发送Keep-Alive响应头(尽管并不是由这个头来决定连接是否

“keep-alive”)

两个参数的值可并不相同

注意不同浏览器怎么处理“keep-alive”头 MSIE和Opera忽略掉"Keep-Alive:

timeout=" header. MSIE保持连接大约60-65秒,然后发送TCP RST Opera永久保

持长连接 Mozilla keeps the connection alive for N plus about 1-10 seconds.

Konqueror保持长连接N秒

lingering_timeout

语法 lingering_timeout time

默认值 5s

本文标签: 连接请求关闭指定