Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to match all requests starting with /images/.
Nginx
location [1] /images/ { } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ~ which is for regex match.
Using = which is for exact match.
Using / which is default prefix but without stopping further regex checks.
✗ Incorrect
The prefix match in nginx uses the ^~ modifier to match the beginning of the URI.
2fill in blank
mediumComplete the code to match requests exactly equal to /about.
Nginx
location [1] /about { } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using / which matches prefix, not exact.
Using ^~ which matches prefix but not exact.
Using ~ which is for regex.
✗ Incorrect
The = modifier matches the exact URI in nginx location blocks.
3fill in blank
hardFix the error in this location block to match all URIs starting with /api/ without regex.
Nginx
location [1] /api/ { } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ~ which treats /api/ as regex.
Using = which matches exact URI only.
Using / which allows regex locations to override.
✗ Incorrect
Using ^~ ensures nginx matches the prefix /api/ and stops searching further regex locations.
4fill in blank
hardFill both blanks to create a location block that matches URIs starting with /static/ and disables regex checks.
Nginx
location [1] [2] { }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ~ which is regex and does not disable further checks.
Using = which matches exact URI only.
Swapping the order of modifier and URI.
✗ Incorrect
The ^~ modifier with the prefix /static/ matches all URIs starting with /static/ and disables regex checks.
5fill in blank
hardFill all three blanks to create a location block that matches URIs starting with /docs/, disables regex, and sets root to /var/www/docs.
Nginx
location [1] [2] { root [3]; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ~ which is regex and does not disable further checks.
Using wrong root path.
Swapping modifier and URI.
✗ Incorrect
Using ^~ with /docs/ disables regex checks and root sets the directory for this location.