0
0
Nginxdevops~10 mins

limit_req_zone and limit_req in Nginx - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a rate limit zone named 'mylimit' with 10 requests per second.

Nginx
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=[1]r/s;
Drag options to blanks, or click blank then click option'
A5
B50
C10
D20
Attempts:
3 left
💡 Hint
Common Mistakes
Using a rate value too low or too high for the example.
Forgetting to add 'r/s' after the number.
2fill in blank
medium

Complete the code to apply the 'mylimit' zone to limit requests in the server block.

Nginx
limit_req zone=[1] burst=5 nodelay;
Drag options to blanks, or click blank then click option'
Amylimit
Bfastlimit
Cdefault
Dzone1
Attempts:
3 left
💡 Hint
Common Mistakes
Using a zone name that was not defined.
Leaving the zone name empty.
3fill in blank
hard

Fix the error in the limit_req_zone directive to correctly set the zone size to 20 megabytes.

Nginx
limit_req_zone $binary_remote_addr zone=mylimit:[1] rate=10r/s;
Drag options to blanks, or click blank then click option'
A20m
B20k
C20g
D20
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the unit, which causes a syntax error.
Using incorrect units like 'k' or 'g' unintentionally.
4fill in blank
hard

Fill both blanks to create a limit_req_zone using the client IP and apply a burst of 10 in the limit_req directive.

Nginx
limit_req_zone [1] zone=iplimit:10m rate=5r/s;
limit_req zone=iplimit burst=[2];
Drag options to blanks, or click blank then click option'
A$binary_remote_addr
B10
C5
D$remote_addr
Attempts:
3 left
💡 Hint
Common Mistakes
Using $remote_addr instead of $binary_remote_addr for the zone key.
Setting burst to a wrong number.
5fill in blank
hard

Fill all three blanks to define a limit_req_zone with 15r/s rate, apply it with a burst of 7, and enable nodelay.

Nginx
limit_req_zone [1] zone=fastlimit:15m rate=[2]r/s;
limit_req zone=fastlimit burst=[3] nodelay;
Drag options to blanks, or click blank then click option'
A$binary_remote_addr
B15
C7
D$remote_addr
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up $remote_addr and $binary_remote_addr.
Using wrong numbers for rate or burst.