Challenge - 5 Problems
Directory Listing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of this nginx configuration snippet?
Given this nginx server block snippet, what will be the result when accessing the /files URL?
location /files {
root /var/www/html;
autoindex on;
}Attempts:
2 left
💡 Hint
autoindex on enables directory listing if no index file is found.
✗ Incorrect
The root directive sets the base directory. autoindex on tells nginx to show a list of files if no index file exists in that directory.
❓ Configuration
intermediate2:00remaining
Which configuration enables directory listing only for /public path?
Select the correct nginx configuration snippet that enables directory listing only for the /public URL path.
Attempts:
2 left
💡 Hint
autoindex must be on and root must point to the base directory.
✗ Incorrect
Option A correctly enables autoindex on for /public and sets root to /var/www/html so /public maps to /var/www/html/public.
❓ Troubleshoot
advanced2:00remaining
Why does directory listing not show despite autoindex on?
You set autoindex on in your nginx config for /data, but visiting /data shows a 403 Forbidden error. What is the most likely cause?
Attempts:
2 left
💡 Hint
Check file system permissions for nginx user.
✗ Incorrect
Even if autoindex is on, nginx needs read permission on the directory to list files. Without it, 403 Forbidden occurs.
✅ Best Practice
advanced2:00remaining
What is the safest way to enable directory listing for a public folder?
Choose the best practice to safely enable directory listing for /public folder in nginx.
Attempts:
2 left
💡 Hint
Limit directory listing to only needed paths.
✗ Incorrect
Enabling autoindex only for /public limits exposure. Global autoindex can expose sensitive directories.
🔀 Workflow
expert3:00remaining
Order the steps to enable and verify directory listing in nginx
Put these steps in the correct order to enable directory listing for /files and verify it works.
Attempts:
2 left
💡 Hint
Check permissions before reloading nginx.
✗ Incorrect
First check permissions (3), then edit config (1), reload nginx (2), then verify in browser (4).