0
0
Nginxdevops~5 mins

limit_req_zone and limit_req in Nginx - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of limit_req_zone in nginx?

limit_req_zone defines a shared memory zone to store request states for limiting request rates from clients. It sets the key to identify clients and the rate limit.

Click to reveal answer
beginner
How does limit_req work in nginx configuration?

limit_req applies the rate limiting defined by limit_req_zone to a specific location or server block, controlling how many requests per second a client can make.

Click to reveal answer
intermediate
What does the burst parameter do in limit_req?

The burst parameter allows a client to exceed the rate limit temporarily by queuing extra requests. This helps smooth traffic spikes without immediate rejection.

Click to reveal answer
beginner
Explain the role of the zone parameter in limit_req.

The zone parameter in limit_req specifies which shared memory zone (defined by limit_req_zone) to use for rate limiting.

Click to reveal answer
intermediate
What happens if a client exceeds the rate limit set by limit_req without a burst?

Requests exceeding the limit are rejected with HTTP status 503 (Service Unavailable) immediately if no burst is configured.

Click to reveal answer
What does limit_req_zone $binary_remote_addr zone=mylimit:10m rate=5r/s; do?
ALimits each client IP to 5 requests per second using a 10MB shared memory zone
BLimits total server requests to 5 per second
CBlocks clients after 5 requests total
DAllows unlimited requests but logs them
Which directive applies the rate limit defined by limit_req_zone?
Alimit_req
Blimit_conn
Climit_rate
Dlimit_zone
What is the effect of setting burst=10 in limit_req?
AIncreases rate limit by 10 requests per second
BBlocks 10 requests immediately
CAllows 10 extra requests to queue temporarily beyond the rate limit
DDisables rate limiting
If no burst is set, what happens when a client exceeds the rate limit?
ARequests are logged but allowed
BRequests are rejected with HTTP 503
CRequests are delayed but accepted
DRequests are queued indefinitely
What key is commonly used in limit_req_zone to identify clients?
A$server_name
B$request_uri
C$host
D$binary_remote_addr
Describe how to configure nginx to limit each client IP to 10 requests per second with a burst of 5.
Think about defining the shared zone first, then applying it with burst.
You got /5 concepts.
    Explain what happens internally when a client sends requests faster than the configured rate limit in nginx using limit_req.
    Consider how nginx tracks and controls request flow per client.
    You got /4 concepts.