variable map for fastcgi_pass

Kyle Sloan kyle at
Mon Sep 25 19:12:52 UTC 2017


I am trying to use a MAP function based on HOSTNAMES to determine if this domain should fastcgi_pass to a php5 or php7 container, but am having problems.

My map looks like
map $host $php_proxy_container {

  default "php5fpm:9000"; <>    "php7fpm:9000";

My fastcgi file looks like

  fastcgi_pass   $php_proxy_container;

I have tried also moving the :9000 of the mapping to the the fastcgi_pass to look like  fastcgi_pass   $php_proxy_container:9000 but alas it did not work either.

I am using MAPs in other places in this same format and they work.

I get a generic 502 bad gateway, and nothing more in the http log.  Changing the fastcgi_pass line to the exact value in the map and restarting does work.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list