In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to configure timeout timeout in Nginx? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Keepalive_timeout
HTTP is a stateless protocol in which the client sends a TCP request to the server and the server disconnects after the response is completed.
If the client sends multiple requests to the server, each request establishes a separate connection to transmit data.
HTTP has a KeepAlive mode that tells webserver to keep the TCP connection open after processing a request. If other requests are received from the client, the server will take advantage of the unclosed connection without the need to establish another connection.
KeepAlive remains open for a period of time, during which time they consume resources. Taking up too much will affect performance.
Nginx uses keepalive_timeout to specify the timeout period (timeout) for KeepAlive. Specifies how long each TCP connection can be maintained. The default value for Nginx is 75 seconds, and some browsers can only hold for up to 60 seconds, so you can set it to 60 seconds. If it is set to 0, the keepalive connection is disabled.
# configuration segment: http, server, locationkeepalive_timeout 60s
Client_body_timeout
Specifies the timeout for sending request body after the client establishes a connection with the server. If the client does not send anything within the specified time, Nginx returns HTTP 408 (Request Timed Out).
# configuration segment: http, server, locationclient_body_timeout 20s
Client_header_timeout
The timeout for the client to send a complete request header to the server. If the client does not send a complete request header,Nginx within the specified time, it returns HTTP 408 (Request Timed Out).
# configuration segment: http, server, locationclient_header_timeout 10s
Send_timeout
The timeout time for the server to transfer data to the client.
# configuration segment: http, server, locationsend_timeout 30s
Timeout for customer connection to nginx. It is recommended within 5 seconds.
Receive client header timeout. Default is 60s. If no complete http header is received within 60s, 408 is returned.
Syntax: client_header_timeout time;Default: client_header_timeout 60sbot context: http, serverDefines a timeout for reading client request header. If a client does not transmit the entire header within this time, the 408 (Request Time-out) error is returned to the client.
Receive client Boy timeout. Default is 60s. If no client byte is received within 60 consecutive seconds, 408 is returned.
Syntax: client_body_timeout time;Default: client_body_timeout 60sbot context: http, server, locationDefines a timeout for reading client request body. The timeout is set only for a period between two successive read operations, not for the transmission of the whole request body. If a client does not transmit anything within this time, the 408 (Request Time-out) error is returned to the client.
Keepalive time. Default is 75s. Usually, keepalive_timeout should be larger than client_body_timeout.
Syntax: keepalive_timeout timeout [header_timeout]; Default: keepalive_timeout 75s; context: http, server, locationThe first parameter sets a timeout during which a keep-alive client connection will stay open on the server side. The zero value disables keep-alive client connections. The optional second parameter sets a value in the "Keep-Alive: timeout=time" response header field. Two parameters may differ.
The "Keep-Alive: timeout=time" header field is recognized by Mozilla and Konqueror. MSIE closes keep-alive connections by itself in about 60 seconds.
It can be understood as the SO_LINGER delay setting when the TCP connection is closed. The default is 5s.
Syntax: lingering_timeout time;Default: lingering_timeout 5sbot context: http, server, locationWhen lingering_close is in effect, this directive specifies the maximum waiting time for more client data to arrive. If data are not received during this time, the connection is closed. Otherwise, the data are read and ignored, and nginx starts waiting for more data again. The "wait-read-ignore" cycle is repeated, but no longer than specified by the lingering_time directive.
Domain name resolution timed out. Default is 30s.
Syntax: resolver_timeout time;Default: resolver_timeout 30sbot context: http, server, locationSets a timeout for name resolution, for example:resolver_timeout 5s
Timeout for sending data to the client. Default is 60s. If the client does not receive 1 byte within 60 consecutive seconds, the connection is closed.
Syntax: send_timeout time;Default: send_timeout 60sbot context: http, server, locationSets a timeout for transmitting a response to the client. The timeout is set only between two successive write operations, not for the transmission of the whole response. If the client does not receive anything within this time, the connection is closed.
Connection timeout between nginx and upstream server
Syntax: proxy_connect_timeout time;Default: proxy_connect_timeout 60sbot context: http, server, locationDefines a timeout for establishing a connection with a proxied server. It should be noted that this timeout cannot usually exceed 75 seconds.
Nginx timed out receiving upstream server data. Default is 60s. If no byte is received within 60 consecutive seconds, the connection is closed.
Syntax: proxy_read_timeout time;Default: proxy_read_timeout 60sbot context: http, server, locationDefines a timeout for reading a response from the proxied server. The timeout is set only between two successive read operations, not for the transmission of the whole response. If the proxied server does not transmit anything within this time, the connection is closed.
Nginx timed out sending data to upstream server. Default is 60s. If no byte is sent within 60 consecutive seconds, the connection is closed.
Syntax: proxy_send_timeout time;Default: proxy_send_timeout 60sbot context: http, server, locationSets a timeout for transmitting a request to the proxied server. The timeout is set only between two successive write operations, not for the transmission of the whole request. If the proxied server does not receive anything within this time, the connection is closed. This is the answer to the question about how to configure timeout timeout in Nginx. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.