nginx Has Many Directives
nginx includes a bunch of directives, & the docs even include an alphabetical index of directives.
Directives are a set of instructions.
The directives I'll note here deal specifically with instructing nginx about timeouts in two ways: (a) client-side, between itself and the client-world (b) server-side, between itself and "backend" proxied service(s).
As a one-line review, nginx here lives between client requests and servers - client requests get to nginx and nginx "passes along" requests to servers. Servers respond, send the respond to nginx, which "passes along" the response to the client.
client-side timeouts to restrict "stalling"
client_header_timeout
Restrict the time it takes for a client to finish sending headers with client_header_timeout. The default value is 60s & can be shortened when the expected request time for headers, alone, is much less.
When might this be helpful? To be a preventative measure against long-lasting open requests to the backend server: this is called the slowloris DDoS attack
http{
client_header_timeout: 5s;
}
client_body_timeout
the client_body_timeout sets a maximum time allowed for a request body to complete.
send_timeout
send_timeout sets the max time allowed to while transmitting the response to the client
keepalive_timeout
keepalive_timeout sets the max time that a client with the "keep-alive" header can stay open
lingering_timeout
the most time to wait for a "lingering" client data request to continue. The default lingering timeout is 5s.
This is connected to the lingering_close directive, which is "on" by default.
resolver_timeout
resolver_timeout is the max time to "resolve" a name resolution (like a dns)