Welcome! Log In Create A New Profile

Advanced

Variable for upstream name in fastcgi_pass

Posted by msingla 
Variable for upstream name in fastcgi_pass
April 06, 2011 05:48PM
Is it possible to support use of variable to point to an upstream while using fastcgi_pass?

Currently, something like following does not work and throws "no port in upstream" error. Replacing the variable with the name of upstream directly works as expected.

upstream xyz_backend {
server 192.168.56.102:9000;
server 192.168.56.103:9000;
}

server{
.....

set $var_backend xyz_backend;

location ~ \.php$ {
root /var/www/sites/xyz;

fastcgi_pass $var_backend;
}
}

My use case for this feature is to dynamically pick the upstream name from a map of cookie value (or host) to upstream names. The cookie value (or host) represents a unique source or type of traffic in this case.

Thanks
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 278
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready