Welcome! Log In Create A New Profile

Advanced

Re: Quick question about try_files

Maxim Dounin
January 07, 2011 08:22PM
Hello!

On Fri, Jan 07, 2011 at 01:27:32PM -0800, Aaron Starr wrote:

> Maxim,
>
> Thanks for your quick reply!
>
> I should have included that in both cases, the default handler is this:
>
> location / {
> try_files $uri $uri/index.html @mongrel_app;
> }
>
> And, there is no /archives/ handler. So, here are the snippets that I think
> are relevant. Working:
>
> location ^~ /providers/ {
> error_page 404 = @archives;
> log_not_found off;
> }
> location @archives {
> rewrite "/providers/(.*)" /archives/providers/$1 last;
> }
> location / {
> try_files $uri $uri/index.html @mongrel_app;
> }
>
> Not working:
>
> location ^~ /providers/ {
> try_files $uri /archives$uri @mongrel_app;
> }
> location / {
> try_files $uri $uri/index.html @mongrel_app;
> }

This should work (and works here without problems, just tested in
both 0.9.3 and 0.7.67). Note though that the second form (with
try_files) won't work with directories.

> Also, I should mention that it in the not-working case, the behavior is that
> it will correctly find the file in /providers/... but if the file is moved
> to /archives/providers/..., it will no longer find it.
>
> I've put all the location directives here: http://pastie.org/1438414

Could you please provide debug log for working and non-working
cases? See http://wiki.nginx.org/Debugging for basic
instructions.

Maxim Dounin

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

Quick question about try_files

Aaron Starr January 07, 2011 02:46PM

Re: Quick question about try_files

Maxim Dounin January 07, 2011 04:06PM

Re: Quick question about try_files

Aaron Starr January 07, 2011 04:32PM

Re: Quick question about try_files

Maxim Dounin January 07, 2011 08:22PM

Re: Quick question about try_files

Aaron Starr January 07, 2011 09:38PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 195
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