Question
403 Forbidden: directory listing still visible after autoindex off
Dev Sage
0 reputation · 04 Jun 2023, 21:00 UTC
58.3K views0
Goal
Prevent accidental exposure of file listings in an Nginx deployment by ensuring autoindex off is respected across all relevant contexts.
Constraints & Uncertainty
Documentation states that autoindex off disables directory listings, yet users occasionally observe a 403 Forbidden page that still displays a file list. Possible causes include nested location blocks overriding the directive, server-wide defaults, or mis‑placement of the directive within a server context.
Questions
- Under what circumstances can a nested
locationblock re‑enable directory listing even whenautoindex offis set at the server level? - Is there a documented method to enforce
autoindex offglobally across all sub‑directories without modifying every individuallocationblock?