FAQ Suggestions --- mapping to file, not folder?

Sergey A. Osokin osa at freebsd.org.ru
Wed Feb 22 18:04:07 UTC 2023


Hi Ivo,

On Wed, Feb 22, 2023 at 09:44:42AM -0800, Ivo Welch wrote:
> I think my fundamental misunderstanding was that a `location` block in
> the nginx configuration always maps to a directory (folder) in the
> file system.  The root just identifies the default file.  (this also
> means that the browser can then always look around for other files in
> this directory, though they may be kept unreadable for security.)

The root directive's description, [1], provides details how the directive
works.  Would you mind to provide more details in case the documentation
is unclear in that place, thank you.

> I was trying to define one specific URL to map to one specific file in
> the file system. Is this possible?  That is, is there a way to map one
> specific URL to one specific file?

The alias directive [2] may help in some cases, so please take a look on
that directive and report back how does that work for you.

Thank you.

References
1. https://nginx.org/en/docs/http/ngx_http_core_module.html#root
2. https://nginx.org/en/docs/http/ngx_http_core_module.html#alias

-- 
Sergey A. Osokin


More information about the nginx mailing list