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

Ivo Welch ivo.welch at gmail.com
Wed Feb 22 17:44:42 UTC 2023


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

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?

/iaw

On Mon, Feb 20, 2023 at 4:08 AM Francis Daly <francis at daoine.org> wrote:
>
> On Sun, Feb 19, 2023 at 05:49:48PM -0800, Ivo Welch wrote:
>
> Hi there,
>
> > thank you, F.  I created a completely new ubuntu VM, with a completely
> > vanilla configuration and only this one extra location statement at
> > http://164.67.176.22/  , describing the nginx configuration and
> > referencing its /wth, and it's not working :-( .
>
> For the convenience of future searchers, it would be better to include
> the content at that url in the mail directly.
>
> In this particular case, I suspect that the key line is
>
> > try /wth, which nginx should resolve to
> > /var/www/fcgi-bin/wth-root.html. However, this causes a 404 error.
>
> When you make the request to /wth and get the 404 response, what is
> written in the nginx error log? That will tell you what nginx thought
> that nginx was doing; if that does not match what you thought that nginx
> should be doing, that might point at the problem.
>
> I suspect that the issue is a misunderstanding of what "root" does --
> http://nginx.org/r/root. That content also includes a link to "alias",
> which might be what you want, depending on what you want to have happen.
>
> Good luck with it,
>
>         f
> --
> Francis Daly        francis at daoine.org
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> https://mailman.nginx.org/mailman/listinfo/nginx


More information about the nginx mailing list