Welcome! Log In Create A New Profile

Advanced

Re: Directory fallback

merlin corey
January 07, 2010 01:36PM
On Wed, Dec 30, 2009 at 3:39 AM, Tobia Conforto
<tobia.conforto@gmail.com> wrote:
> Eureka!
>
> Final version, accomplishing all my objectives:
>  - site dir, with fallback to base dir;
>  - static files directly, php files through fastcgi;
>  - not calling fastcgi on nonexistent files;
>  - not using "if" (somebody mentioned performance problems?)
>
> location / {
>  root /var/www/site1;
>  try_files $uri @base;
> }
> location @base {
>  root /var/www/base;
> }
> location ~ \.php$ {
>  root /var/www/site1;
>  try_files $uri @basephp;
>  fastcgi_pass 127.0.0.1:9000;
> }
> location @basephp {
>  root /var/www/base;
>  try_files $uri ERROR;
>  fastcgi_pass 127.0.0.1:9000;
> }
>
> Is there anything nicer I can put in the last try_files, instead of the nonexistent file "ERROR"?
>
> Tobia
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx
>

The final parameter for try_files SHOULD be a guaranteed to exist
location (such as your static 404 page).

if does indeed add a bit of overhead into things but there's no real
numbers to suggest how much -- for most purposes it's obviously not
TOO much, but there's no point in wasting resources just to waste
them, either.

-- Merlin

`

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

Directory fallback

Tobia Conforto December 29, 2009 01:00PM

Re: Directory fallback

merlin corey December 29, 2009 04:24PM

Re: Directory fallback

Tobia Conforto December 29, 2009 06:32PM

Re: Directory fallback

merlin corey December 30, 2009 02:32AM

Re: Directory fallback

Tobia Conforto December 30, 2009 06:46AM

Re: Directory fallback

merlin corey January 07, 2010 01:36PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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