Upstream setup with proxy and fastcgi?

Francis Daly francis at daoine.org
Mon Apr 18 21:06:14 MSD 2011


On Mon, Apr 18, 2011 at 12:30:00PM -0400, TECK wrote:

Hi there,

I've re-read the thread, and I'm not sure what you are trying to
do. Hopefully the following will be useful; if not, if you could include
a clear picture of what services should be running and how they should
interact, it might make it easier for the next person to offer help.

> In theory, all I have to do is this:
> 
> location / {
>     proxy_pass http://proxy;
> }

If your backend servers are nginx, each configured to talk to a fastcgi
server, then the above should be pretty much all you need.

> location ~ \.php$ {
>     fastcgi_pass php;
>     include fastcgi.conf;
> }

That will be useful if your frontend server (= load balancer) should
split the .php urls separately from the other urls.

> However, I have a script that is processed like that on a normal single
> server setup:
> location /forum/ {
>     try_files $uri $uri/ /forum/data.php$args;
> }
> 
> How would I make the try_files work with the load balancer scheme?

I think you've said that your front-end doesn't have files, so try_files
can't work.

Perhaps using

  proxy_intercept_errors on;

with

  error_page 404 = /forum/data.php$args;

inside the "location /" block would work in a similar way? (Although
it might need to be /forum/data.php?$args, for the php-using location
to match.)

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list