Welcome! Log In Create A New Profile

Advanced

Re: try_files and a nested location regexp

Francis Daly
October 16, 2014 07:30AM
On Thu, Oct 16, 2014 at 07:09:44AM -0400, igorb wrote:

Hi there,

> location ~ ^/x/(test.*)$ {
> alias /test/$1;
> try_files $uri =404;
> }

> However that still gives 404 for localhost/x/test.html . Does that mean that
> try_files cannot be used at all in a regexp location defined with an alias,
> it only works if the location uses the root directive?

try_files puts its "file" argument after $document_root, and looks for
a file on the filesystem with that combined name.

alias-with-regex sets $document_root to the value given.

So if you want try_files and alias-with-regex, you want something like

try_files "" =404

But that specific use of try_files is probably not very useful, since
it is mostly the same as having no try_files at all -- I guess it is a
simplified version of what you really want, so it is useful as an example.

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: 194
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