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

Denis S. Filimonov den.lists at gmail.com
Tue Feb 12 01:18:25 MSK 2008


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.

-- 
Denis.





More information about the nginx mailing list