Syntax: keepalive_timeout timeout [header_timeout]; Default: keepalive_timeout 75s; Context: http, server, location The 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.
HTTP is a stateless protocol. The client sends a TCP request to the server, and the server disconnects after the response.
If the client sends multiple requests to the server, each request establishes its own independent connection to transmit data.
HTTP has a KeepAlive mode, which 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 connection that has not been closed without establishing another connection.
KeepAlive remains open for a period of time, during which time they take up resources. Too much usage can affect performance.
Nginx uses keepalive Ou timeout to specify the timeout of keepalive. Specifies how long each TCP connection can last at most. The default value of nginx is 75 seconds. Some browsers can only hold 60 seconds at most, so it can be set to 60 seconds. Setting it to 0 disables the keepalive connection.
keepalive time, 75s by default, usually larger than client body timeout
The "Keep-Alive: timeout=time" header field is recognized by Mozilla and Konqueror. MSIE closes keep-alive connections by itself in about 60 seconds.
Syntax: client_header_timeout time; Default: client_header_timeout 60s; Context: http, server Defines 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.
Timeout for receiving client header, default is 60s. If no complete http header is received within 60s, 408 will be returned
Timeout for the client to send a complete request header to the server. If the client does not send a complete request header within the specified time, Nginx returns HTTP 408 (Request Timed Out).
Syntax: client_body_timeout time; Default: client_body_timeout 60s; Context: http, server, location Defines 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.
Specifies the timeout for sending the request body after the client establishes a connection with the server. If the client does not send any content within the specified time, Nginx returns HTTP 408 (Request Timed Out).
Timeout of receiving client body, default is 60s, if no one byte of client is received in consecutive 60s, 408 is returned
Syntax: send_timeout time; Default: send_timeout 60s; Context: http, server, location Sets 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.
Timeout for data transmission from server to client. The default is 60s. If the client does not receive one byte within 60s, the connection is closed
Timeout of client connection nginx, recommended within 5s
Syntax: lingering_timeout time; Default: lingering_timeout 5s; Context: http, server, location When 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.
It can be understood as the so? Linger delay setting when the TCP connection is closed. The default is 5s. Before closing the connection, it will detect whether the data sent by the user has arrived at the server. If there is no data readable after the lingering [timeout], the connection will be closed directly; otherwise, the connection will not be closed until the data on the connection buffer has been read and discarded.
Syntax: resolver_timeout time; Default: resolver_timeout 30s; Context: http, server, location Sets a timeout for name resolution, for example: resolver_timeout 5s;
Domain name resolution timeout, default 30s
Syntax: proxy_connect_timeout time; Default: proxy_connect_timeout 60s; Context: http, server, location Defines a timeout for establishing a connection with a proxied server. It should be noted that this timeout cannot usually exceed 75 seconds.
The connection timeout between nginx and upstream server usually does not exceed 75 seconds. Default: 60s. This is not the time to wait for the back-end to return to the page, which is declared by proxy read timeout. If your upstream server is up, but hanging is up (for example, there are not enough threads to process the request, so put your request into the request pool for later processing), this declaration is useless, because the connection with the upstream server has been established.
Syntax: proxy_read_timeout time; Default: proxy_read_timeout 60s; Context: http, server, location Defines 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.
Define the timeout time for a nginx to wait for the real server response data. The timeout is only set between two consecutive read operations, not used to transmit the entire response. The default is 60s. If one byte is not received within 60s, the connection is closed
Syntax: proxy_send_timeout time; Default: proxy_send_timeout 60s; Context: http, server, location Sets 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.
The timeout of nginx sending data to upstream server is only set between two consecutive write operations, not for the whole sending period. If upstream does not receive new data after timeout, nginx closes the connection. The default is 60s. If no byte is sent within 60s, the connection is closed
2. 499 error: https://aliasmee.github.io/post/questions-about-proxy-connect-timeout-on-nginx/