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

Francis Daly francis at daoine.org
Wed Feb 22 21:22:17 UTC 2023


On Wed, Feb 22, 2023 at 09:44:42AM -0800, Ivo Welch wrote:

Hi there,

> I think my fundamental misunderstanding was that a `location` block in
> the nginx configuration always maps to a directory (folder) in the
> file system.

Yes, that's a misunderstanding.

The details at http://nginx.org/r/location might help clarify; but they
may be too terse for this.

> The root just identifies the default file. 

That's a misunderstanding too. http://nginx.org/r/root for details.

> (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.)

I'm not sure how that relates to the previous lines. Yes, the browser
can request any url. The server can choose how to respond to each request.

> 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?

	location = /this-url { alias /var/www/that-file.txt; }

Cheers,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list