0
0
Nginxdevops~5 mins

Directory listing (autoindex) in Nginx - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the autoindex directive do in nginx?
The autoindex directive enables or disables automatic directory listing when no index file is found in a directory.
Click to reveal answer
beginner
How do you enable directory listing for a specific location in nginx?
Inside the location block, set autoindex on; to enable directory listing for that path.
Click to reveal answer
beginner
What is the default state of autoindex in nginx?
By default, autoindex is off, so directory listing is disabled unless explicitly enabled.
Click to reveal answer
beginner
Which nginx configuration block is used to control directory listing?
The location block controls directory listing by using the autoindex directive inside it.
Click to reveal answer
intermediate
What happens if autoindex is off and no index file exists in a directory?
nginx will return a 403 Forbidden or 404 Not Found error instead of showing the directory contents.
Click to reveal answer
Which directive enables directory listing in nginx?
Adirlist enable;
Bautoindex on;
Clistdir on;
Dindex on;
Where do you place the autoindex directive to enable directory listing?
AInside the <code>server</code> block only
BInside the <code>http</code> block only
CInside the <code>location</code> block
DIn the <code>events</code> block
What is the default value of autoindex in nginx?
Atrue
Bon
Cenabled
Doff
If directory listing is disabled and no index file exists, what does nginx do?
AReturns 403 or 404 error
BRedirects to homepage
CShows directory contents
DAutomatically creates an index file
How do you disable directory listing if it was previously enabled?
ASet <code>autoindex off;</code> in the location block
BRemove the <code>location</code> block
CSet <code>index off;</code>
DRestart nginx without changes
Explain how to enable directory listing in nginx and what configuration block is used.
Think about where nginx controls URL paths and how to turn on directory listing.
You got /4 concepts.
    Describe what happens when directory listing is disabled and a user tries to access a directory without an index file.
    Consider nginx's default behavior when it cannot find a file to serve.
    You got /4 concepts.