Welcome! Log In Create A New Profile

Advanced

Re: try_files and a nested location regexp

Francis Daly
October 16, 2014 08:20AM
On Thu, Oct 16, 2014 at 07:55:48AM -0400, igorb wrote:

Hi there,

> Thanks, try_files "" =404 works indeed as long as the regexp location block
> contains the necessary alias.

That sounds correct.

"alias" sets $document_root. try_files concatenates $document_root with
its "file" argument. (It does do more than that; those details might
matter depending on what precisely you want to do.)

So if you want to use try_files, you must make sure that $document_root
and the "file" argument combine to name the file that you want to check
the existence of.

> location /x/ {
> alias /test/;
> location ~ ^/x/test {
> try_files "" =404;
> }
> }

> does not work,

$document_root concatenated with "" is /test/, which is not a file,
so =404 is used.

> This is indeed a very simplified config. However, even in this form it is
> useful as it reports directories matching ^/x/test as not found even with
> autoindex on inherited from the server context.

If you want try_files to look for a directory instead of a file, you
have to configure it to do that.

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

try_files and a nested location regexp

igorb October 16, 2014 05:38AM

Re: try_files and a nested location regexp

Sergey Kandaurov October 16, 2014 06:02AM

Re: try_files and a nested location regexp

igorb October 16, 2014 07:09AM

Re: try_files and a nested location regexp

Edho Arief October 16, 2014 07:14AM

Re: try_files and a nested location regexp

igorb October 16, 2014 07:25AM

Re: try_files and a nested location regexp

Edho Arief October 16, 2014 07:42AM

Re: try_files and a nested location regexp

igorb October 16, 2014 08:03AM

Re: try_files and a nested location regexp

Edho Arief October 16, 2014 08:32AM

Re: try_files and a nested location regexp

Francis Daly October 16, 2014 07:30AM

Re: try_files and a nested location regexp

igorb October 16, 2014 07:55AM

Re: try_files and a nested location regexp

Francis Daly October 16, 2014 08:20AM

Re: try_files and a nested location regexp

igorb October 16, 2014 08:42AM

Re: try_files and a nested location regexp

Francis Daly October 16, 2014 09:20AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 317
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready