Recall & Review
beginner
What is a wildcard server name in nginx?
A wildcard server name uses an asterisk (*) to match multiple subdomains or domain patterns. For example,
*.example.com matches app.example.com, blog.example.com, etc.Click to reveal answer
intermediate
How do you define a regex server name in nginx?
You define a regex server name by prefixing the server name with a tilde (~). For example,
server_name ~^www\d+\.example\.com$; matches www1.example.com, www123.example.com, etc.Click to reveal answer
intermediate
What is the difference between a wildcard and a regex server name in nginx?
A wildcard uses simple patterns with an asterisk (*) to match subdomains, while regex uses full regular expressions for more flexible and complex matching.
Click to reveal answer
advanced
How does nginx prioritize server names when multiple match?
Nginx prioritizes exact server names first, then wildcard names starting with an asterisk, then wildcard names ending with an asterisk, and finally regex server names.
Click to reveal answer
advanced
Write an nginx server_name directive to match any subdomain of example.com except 'www'.
Use a regex to exclude 'www': <br>
server_name ~^(?!www\.)[^.]+\.example\.com$;<br>This matches any subdomain except 'www.example.com'.Click to reveal answer
Which nginx server_name matches all subdomains of example.com?
✗ Incorrect
The wildcard
*.example.com matches all subdomains like app.example.com.How do you indicate a regex server name in nginx?
✗ Incorrect
Regex server names start with a tilde (~) in nginx.
Which server_name has the highest priority in nginx?
✗ Incorrect
Exact server names have the highest priority in nginx.
What does the server_name directive
~^www\d+\.example\.com$ match?✗ Incorrect
This regex matches www followed by digits, e.g., www1.example.com.
Which of these is NOT a valid wildcard server_name in nginx?
✗ Incorrect
Wildcard must be at the start or end with a dot, '*example.com' is invalid.
Explain how to use wildcard and regex server names in nginx and when to choose each.
Think about simple subdomain matching vs complex patterns.
You got /4 concepts.
Describe nginx server_name matching priority and why it matters.
Consider what happens if multiple server names match a request.
You got /3 concepts.