Issue w/ nginx in hybrid static/php load balancer scenario
Mike Javorski
mike.javorski at gmail.com
Tue Feb 12 00:56:07 MSK 2008
I've gotten things to work OK w/ the following. It means I can't have
more than one type of directory index, but it's better than nothing.
Thanks for the suggestions all, and Igor, thanks for nginx period :-).
- mike
server {
listen 80;
root /website/htdocs;
index index.php;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
location / {
proxy_pass http://static-pool/website/htdocs/;
}
location ~ (\.php|/)$ {
fastcgi_pass php-fcgi-pool;
}
On Feb 9, 2008 10:32 PM, Mike Javorski <mike.javorski at gmail.com> wrote:
> I have nginx set up as a load balancer in front of two machines
> running fastcgi/php, and nginx for static content. The desired goal is
> to have all php pages (including the site index pages of .*/index.php)
> processed by the fastcgi/php upstream, and everything else provided by
> the static servers. The following is what I have and what I believe
> should have worked, but it appears to run all directory paths via the
> static rule, rather than the php rule which matches the index.
>
> To sum up:
> / -- via static system (WRONG)
> /index.php -- via fastcgi/php system (RIGHT)
> /blah/ -- via static system (WRONG)
> /blah/index.php -- via fastcgi/php system (RIGHT)
>
> nginx version is 0.6.25, Help! :-)
>
> tia,
>
> - mike
>
> My Config File (the relevent bits anyway):
> ---------------------------------------------------
>
> http {
> upstream static-pool {
> server 192.168.7.40:80;
> server 192.168.7.41:80;
> }
>
> upstream php-fcgi-pool {
> server 192.168.7.40:7000;
> server 192.168.7.41:7000;
> }
>
> server {
> listen 80;
> root /website/htdocs;
> index index.php;
> fastcgi_index index.php;
> include /etc/nginx/fastcgi_params;
>
> location / {
> proxy_pass http://static-pool/website/htdocs/;
> }
>
> location ~ \.php$ {
> fastcgi_pass php-fcgi-pool;
> }
> }
> }
>
More information about the nginx
mailing list