Recall & Review
beginner
What is a prefix match in nginx configuration?
A prefix match in nginx is a way to match the beginning part of a URL path to decide how to handle the request. It checks if the URL starts with a specific string.
Click to reveal answer
beginner
How do you define a prefix match location block in nginx?
You define it by using
location /prefix/ { ... } without any special symbols. This matches any URL starting with '/prefix/'.Click to reveal answer
intermediate
What is the difference between prefix match and exact match in nginx?
Prefix match checks if the URL starts with a string, while exact match uses
= to match the URL exactly with no extra characters.Click to reveal answer
intermediate
What happens if multiple prefix matches apply to a request in nginx?
Nginx chooses the longest matching prefix. For example, if both
/app/ and /app/api/ match, it picks /app/api/.Click to reveal answer
beginner
Can prefix matches in nginx use regular expressions?
No, prefix matches are simple string matches. Regular expressions require
~ or ~* modifiers in location blocks.Click to reveal answer
Which nginx location block uses prefix match?
✗ Incorrect
The block without any special symbols uses prefix match. '=' is exact match, '~' is regex, '^~' is prefix match with priority.
If you have location /app/ and location /app/api/, which one handles /app/api/users?
✗ Incorrect
Nginx picks the longest prefix match, so /app/api/ handles /app/api/users.
What symbol marks an exact match in nginx location?
✗ Incorrect
The '=' symbol marks an exact match in nginx location blocks.
Can prefix match location blocks use regular expressions?
✗ Incorrect
Prefix matches are simple string matches and do not support regex.
What does the '^~' modifier do in nginx location?
✗ Incorrect
The '^~' modifier tells nginx to use prefix match and stop searching further if matched.
Explain how nginx chooses a location block when multiple prefix matches exist.
Think about which prefix is the longest that fits the URL.
You got /3 concepts.
Describe the difference between prefix match and exact match in nginx location blocks.
Consider how nginx treats the URL string in each case.
You got /3 concepts.