Recall & Review
beginner
What does the
= symbol mean in an nginx location block?It means the location will match the request URI exactly, without any extra characters or variations.
Click to reveal answer
beginner
How does nginx treat a
location = /path compared to location /path?The
= /path matches only the exact URI /path, while /path matches any URI starting with /path.Click to reveal answer
intermediate
Why use
= for exact match in nginx locations?To ensure that only requests with the exact URI are handled by that block, avoiding partial or prefix matches.
Click to reveal answer
intermediate
What happens if multiple nginx location blocks match a request URI and one uses
=?The exact match location with
= is chosen first before prefix or regex matches.Click to reveal answer
beginner
Write a simple nginx location block using exact match for URI
/hello.location = /hello {
return 200 "Hello exact match!";
}
Click to reveal answer
What does
location = /test match in nginx?✗ Incorrect
The '=' sign means exact match, so only the URI exactly '/test' matches.
If you have
location = /foo and location /foo, which handles the request to /foo?✗ Incorrect
Exact match with '=' has higher priority and will handle the request.
Can
location = / be used to match only the homepage URI exactly?✗ Incorrect
Using '=' with '/' matches only the exact homepage URI.
What is the main benefit of using exact match
= in nginx locations?✗ Incorrect
Exact match is faster and more precise for specific URIs.
Which symbol is used in nginx to specify an exact match in a location block?
✗ Incorrect
The '=' symbol is used for exact match in nginx location blocks.
Explain how nginx processes location blocks when one uses exact match (=) and others use prefix matches.
Think about priority order in nginx location matching.
You got /4 concepts.
Describe a scenario where using exact match (=) in nginx location is better than prefix match.
Consider when you want to be very precise about which requests are handled.
You got /4 concepts.