Recall & Review
beginner
What does the
root directive do in an nginx configuration?The
root directive sets the directory path where nginx looks for files to serve for a given location or server block.Click to reveal answer
beginner
Where can the
root directive be used in nginx configuration?It can be used inside the
http, server, or location blocks to specify the root directory for serving files.Click to reveal answer
intermediate
How does nginx combine the
root directive path with the request URI?Nginx appends the request URI to the path set by the
root directive to find the file to serve.Click to reveal answer
intermediate
What happens if the
root directive is set in both server and location blocks?The
root directive in the location block overrides the one in the server block for that location.Click to reveal answer
beginner
Example: How to set the root directory to
/var/www/html for a server in nginx?Inside the
server block, add: <br>root /var/www/html;
Click to reveal answer
What does the nginx
root directive specify?✗ Incorrect
The
root directive tells nginx the folder path to find files for requests.If
root is set in both server and location blocks, which one is used for that location?✗ Incorrect
The
location block's root overrides the server block's root for that location.How does nginx find the file to serve when a request comes in?
✗ Incorrect
Nginx appends the request URI to the
root directory path to locate the file.Where can the
root directive NOT be used?✗ Incorrect
The
root directive is not valid inside the events block.What is the correct syntax to set the root directory to
/usr/share/nginx/html?✗ Incorrect
The correct syntax is
root /usr/share/nginx/html; without equals sign or colon.Explain how the nginx
root directive works and where it can be used.Think about how nginx finds files to serve for web requests.
You got /3 concepts.
Describe what happens when
root is set in both server and location blocks in nginx.Consider configuration precedence in nginx.
You got /3 concepts.