Welcome! Log In Create A New Profile

Advanced

Re: try_files and a nested location regexp

Francis Daly
October 16, 2014 09:20AM
On Thu, Oct 16, 2014 at 08:42:26AM -0400, igorb wrote:

Hi there,

> Thanks again for detailed explanation. Now I almost grasped how try_files
> works. "Almost" because I still do not see why the following does not work:

There is a defect which is involved here, and probably interferes:

http://trac.nginx.org/nginx/ticket/97

Anything involving try_files and alias may not do what you expect.

If you can specify what exactly you want, it may be possible to find a
configuration which does that using the current implementation of the
defect. Or it may not be.

You will probably be much happier investigating if you enable the
debug log.

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

> For localhost/x/test.html $1 will be test.html. I suppose $document_root
> should be /test/ as it was set with the alias in the outer location so
> try_files should try to check for existing /test/test.html . However, nginx
> still reports 404. Why it is so?

Can you tell whether the 404 is from the uri argument of try_files,
or the serve-from-filesystem handler?

Look in the debug log and you will see what happens.

Or: what do you see if you change try_files to end in =405?

The rest is "the details of what else try_files and alias do".

(try_files does see /test/test.html, but the serve-from-filesystem
handler does not try to serve that file.)

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