Welcome! Log In Create A New Profile

Advanced

Directory fallback

Tobia Conforto
December 29, 2009 01:00PM
Hello

I'm trying to come up with a nginx configuration file for a fallback-like directory structure.

I have the following directories:
/var/www/base/ (generic files)
/var/www/site1/ (files specific to site1)

Given a request for /logo.png, I would like nginx to do the following:
1. serve /var/www/site1/logo.png if exists; otherwise
2. serve /var/www/base/logo.png.

The matter is complicated by the presence of PHP files. Given a request for /index.php (possibly in the same directory as image files...) nginx should:
1. serve /var/www/site1/index.php through FastCGI, if the php file exists; otherwise
2. serve /var/www/base/index.php through FastCGI.

Can anybody please suggest the optimal combination of document_root, alias, location, rewrite, try_files or such options to use? I would like to avoid client-side redirects. Everything else is ok.

Tobia
_______________________________________________
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: 172
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