Nginx map assigned variable usage in upstream?

George nginx-forum at forum.nginx.org
Thu Feb 24 11:19:57 UTC 2022


I am trying use a Nginx map assigned variable in an upstream but it doesn't
seem to work?

The map is concatenated $uri$args assigning a PHP-FPM fastcgi PHP pool to
variable $pool and then setting the $pool variable in an upstream.

map $uri$args $pool {
    default                    127.0.0.1:9000;
    "~/index.php/args"  127.0.0.1:9002;  
}

upstream php {
  zone php_zone 64k;
  server $pool;
  keepalive 2;
}

But if I try this, nginx config test gives me

nginx -t
nginx: [emerg] host not found in upstream "$pool" in ...

What am I missing?

cheers

George

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,293738,293738#msg-293738



More information about the nginx mailing list