Recall & Review
beginner
What is a
location block in nginx?A
location block defines how nginx should respond to requests for specific URLs or URL patterns.Click to reveal answer
beginner
How do you write a simple
location block to match the URL /images/?Use
location /images/ { ... } to match all requests starting with /images/.Click to reveal answer
intermediate
What is the difference between
location = /path and location /path?location = /path matches the exact URL /path only, while location /path matches any URL starting with /path.Click to reveal answer
intermediate
What does the
^~ modifier do in a location block?The
^~ modifier tells nginx to stop searching if this prefix match is found and use this block immediately.Click to reveal answer
advanced
How does nginx choose which
location block to use when multiple match?Nginx first looks for exact matches, then prefix matches with
^~, then regex matches, and finally the longest prefix match.Click to reveal answer
Which
location block matches only the exact URL /about?✗ Incorrect
The '=' modifier matches the exact URL only.
What does the
^~ modifier do in a location block?✗ Incorrect
The '^~' modifier tells nginx to stop searching if this prefix matches.
Which location block matches URLs starting with
/api/?✗ Incorrect
A prefix match without modifiers matches URLs starting with the given path.
If multiple location blocks match, which one does nginx prefer first?
✗ Incorrect
Nginx prefers exact matches before other types.
How do you define a location block that matches URLs using a regex?
✗ Incorrect
The '~' modifier defines a regex match in location blocks.
Explain how nginx chooses which location block to use when multiple blocks match a request URL.
Think about the order nginx checks location blocks.
You got /4 concepts.
Describe the difference between prefix matches and regex matches in nginx location blocks.
Consider how nginx processes URL patterns.
You got /4 concepts.