Issue w/ nginx in hybrid static/php load balancer scenario

Igor Sysoev is at rambler-co.ru
Tue Feb 12 01:24:46 MSK 2008


On Mon, Feb 11, 2008 at 05:18:25PM -0500, Denis S. Filimonov wrote:

> On Monday 11 February 2008 01:53:36 Igor Sysoev wrote:
> > On Sun, Feb 10, 2008 at 10:28:09PM -0500, Denis S. Filimonov wrote:
> > > I'd try something like the following:
> > >
> > > location / {
> > >     if ($request_filename !~ "(\.php|/)$") {
> > >     	proxy_pass http://static-pool/website/htdocs/;
> > >     }
> > > }
> > >
> > > set $dir_index index.php;
> > >
> > > location ~ /$ {
> > > 	set $index_php $root$uri$dir_index;
> > > 	if (-f $index_php) {
> > > 		fastcgi_pass    php-fcgi-pool;
> > > 		break;
> > > 	}
> > > 	proxy_pass http://static-pool/website/htdocs/;
> > > }
> > >
> > > location ~ \.php$ {
> > >      fastcgi_pass    php-fcgi-pool;
> > > }
> >
> > There is no need of such spaghetti configuration:
> > all tests can be done via location regex and index directive.
> >
> 
> I believe the spaghetti is necessary to handle the following, I quote:
> ---
>  I suppose I could to a regex for .*/$ but some of the directories
> have index.html instead of index.php, and I need to support that as well
> ---
> 
> In the configuration above, .*/$ locations will be passed to FastCGI only if 
> there is an index.php and passed to the proxy otherwise.

If nginx has access to these index files, then index directive tries
index.php and index.html and does internal redirect to index.php or index.html.
The index.php will go to FastCGI.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list