Getting FastCGI Upstream Information

Maxim Dounin mdounin at
Fri Dec 25 19:14:35 MSK 2009


On Fri, Dec 25, 2009 at 10:57:41PM +0700, Arie Karhendana wrote:

> Hi all,
> I think this is not nginx specific question per se, but seeing all
> experts here, maybe this list is the right place to start.
> We have an nginx & PHP FastCGI configuration, where nginx is run on
> different server than the PHP backends. We employ upstream
> load-balancing scheme like this:
> upstream upstream-php {
>         fair;
>         server;
>         server;
>         .....
> }
> We want to know the address of PHP upstream that currently serve the
> request, and send it to the backend using fastcgi_param. We tried
> adding this to the configuration:
> fastcgi_param UPSTREAM_ADDR $upstream_addr;
> But the UPSTREAM_ADDR param is always empty.
> Maybe I'm doing it wrong? Any clues?

This wont work as selecting upstream server happens after creating 
request to backend.  Moreover, different upstream server may be 
selected if first one fails (and the same request will be used 
against another upstream server).

Maxim Dounin

More information about the nginx mailing list