Nginx has various options for managing inbound traffic. This includes the following:
Limiting the request rate
Limiting the number of simultaneous connections
Limiting the transfer rate of a connection
These features are very useful for managing the quality of your web service and to prevent and mitigate abuses.
Nginx has a built-in module for limiting the request rate. Before you can enable it, you need to configure a shared memory segment (also known as a zone) in the http
section using the limit_req_zone
directive. This directive has the following format:
limit_req_zone <key> zone=<name>:<size> rate=<rate>;
The <key>
argument specifies a single variable or a script (since version 1.7.6) to which the rate limiting state is bound. In simple terms, by specifying the <key>
argument, you are creating a number of small pipes for each value of the <key>
argument evaluated at runtime, each of them with its request...