variable map for fastcgi_pass
Kyle Sloan
kyle at ifsight.com
Mon Sep 25 19:12:52 UTC 2017
Hello,
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 {
hostnames;
default "php5fpm:9000";
www.example.com <http://www.example.com/> "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: <http://mailman.nginx.org/pipermail/nginx/attachments/20170925/4cf304b0/attachment.html>
More information about the nginx
mailing list