Recall & Review
beginner
What does the
limit_conn directive do in nginx?It limits the number of simultaneous connections for a defined key, such as an IP address, to control traffic and prevent overload.
Click to reveal answer
intermediate
How do you define a shared memory zone for connection limiting in nginx?
Use
limit_conn_zone $variable zone=name:size; to create a zone that tracks connections by the variable (e.g., $binary_remote_addr).Click to reveal answer
intermediate
Example: What does this configuration do?<br>
limit_conn_zone $binary_remote_addr zone=addr:10m;<br>limit_conn addr 5;
It limits each client IP address to a maximum of 5 simultaneous connections using a 10MB shared memory zone named 'addr'.
Click to reveal answer
beginner
What happens when a client exceeds the connection limit set by
limit_conn?nginx returns a 503 Service Unavailable error to the client, refusing additional connections beyond the limit.
Click to reveal answer
beginner
Why is connection limiting useful in a web server?
It helps protect the server from overload, prevents abuse, and ensures fair resource use among clients.
Click to reveal answer
Which directive creates a shared memory zone for connection limiting in nginx?
✗ Incorrect
The
limit_conn_zone directive defines the shared memory zone to track connections.What variable is commonly used to limit connections per client IP in nginx?
✗ Incorrect
$binary_remote_addr represents the client IP in a compact form for connection limiting.If you set
limit_conn addr 10;, what does it mean?✗ Incorrect
It limits each key in the zone 'addr' (usually IP) to 10 simultaneous connections.
What response code does nginx send when connection limit is exceeded?
✗ Incorrect
nginx returns 503 Service Unavailable when connection limits are exceeded.
Which of these is NOT a benefit of connection limiting?
✗ Incorrect
Connection limiting does not affect CPU speed; it controls traffic to protect resources.
Explain how to configure nginx to limit the number of simultaneous connections per client IP.
Think about tracking IPs and setting max connections.
You got /3 concepts.
Describe what happens when a client exceeds the connection limit set by nginx's limit_conn directive.
What does the server do when too many connections come from one client?
You got /3 concepts.