What will the directory listing show regarding file sizes and timestamps?
medium
A. File sizes in human-readable format and timestamps in local time.
B. File sizes in bytes and timestamps in UTC time.
C. File sizes hidden and timestamps not shown.
D. File sizes in human-readable format and timestamps in UTC time.
Solution
Step 1: Understand autoindex_exact_size off;
This setting shows file sizes in human-readable format (e.g., KB, MB) instead of bytes.
Step 2: Understand autoindex_localtime on;
This setting shows file timestamps in the server's local time zone, not UTC.
Final Answer:
File sizes in human-readable format and timestamps in local time. -> Option A
Quick Check:
autoindex_exact_size off + autoindex_localtime on = human sizes + local time [OK]
Hint: Exact size off = human sizes; localtime on = local timestamps [OK]
Common Mistakes:
Assuming sizes always show in bytes
Thinking timestamps are always UTC
Confusing off/on meaning for these directives
4. You enabled autoindex on; but directory listing still does not show. Which is the most likely cause?
medium
A. The server block is missing the listen directive.
B. The autoindex directive is misspelled as autoindx.
C. The directory has an index.html file present.
D. The autoindex directive must be inside http block only.
Solution
Step 1: Check nginx directory listing behavior
nginx shows directory listing only if no index file (like index.html) exists in the directory.
Step 2: Identify why listing is not shown
If an index file is present, nginx serves it instead of showing directory listing, even if autoindex on; is set.
Final Answer:
The directory has an index.html file present. -> Option C
Quick Check:
Index file present blocks directory listing [OK]
Hint: Index files override autoindex directory listing [OK]
Common Mistakes:
Assuming misspelling causes no effect (it causes error)
Thinking autoindex must be in http block only
Ignoring presence of index files
5. You want to allow users to browse files in /var/www/public via nginx with directory listing enabled, showing file sizes in human-readable format and timestamps in local time. Which configuration snippet inside the server block is correct?