Chapter 6
[ 129 ]
First, let's take a look at the different configuration directives that will help us
achieve our goal:
Table: HTTP limits directives
Directive Explanation
limit_conn Specifies a shared memory zone (configured
with limit_conn_zone) and the
maximum number of connections that are
allowed per key value.
limit_conn_log_level When NGINX limits a connection due to
the limit_conn directive, this directive
specifies at which log level that limitation is
reported.
limit_conn_zone Specifies the key to be limited in limit_
conn as the first parameter. The second
parameter, zone, indicates the name of the
shared memory zone used to store the key
and current number of connections per key
and the size of that zone (name:size).
limit_rate Limits the rate (in bytes per second) at which
clients can download content. The rate limit
works on a connection level, meaning that a
single client could increase their throughput
by opening multiple connections.
limit_rate_after Starts the limit_rate after this number of
bytes have been transferred.
limit_req Sets a limit with bursting capability on the
number of requests for a specific key in
a shared memory store (configured with
limit_req_zone). The burst can be
specified with the second parameter. If there
shouldn't be a delay in between requests up
to the burst, a third parameter nodelay
needs to be configured.
limit_req_log_level When NGINX limits the number of requests
due to the limit_req directive, this
directive specifies at which log level that
limitation is reported. A delay is logged at a
level one less than the one indicated here.