Thanks for the response. Both the variables respond/work when they are not maps/variables and just set. I will try out the resolver and see if I can make any progress with it.
Kyle Sloan DevOps Engineer | Interpersonal Frequency k...@ifsight.com https://ifsight.com > On Sep 25, 2017, at 4:13 PM, Sergey Kandaurov <pluk...@nginx.com> wrote: > >> >> On 25 Sep 2017, at 22:12, Kyle Sloan <k...@ifsight.com> wrote: >> >> 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 "php7fpm:9000"; >> } >> >> >> My fastcgi file looks like >> >> fastcgi_pass $php_proxy_container; >> >> >> [..] >> >> 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. >> > > If variable used within fastcgi_pass evaluates to something like > hostname:port, you need to define resolver to resolve that name. > http://nginx.org/r/resolver <http://nginx.org/r/resolver> > > OTOH, if that name is used within fastcgi_pass literally, > it would be resolved at startup by system resolver instead. > > -- > Sergey Kandaurov > > _______________________________________________ > nginx mailing list > nginx@nginx.org <mailto:nginx@nginx.org> > http://mailman.nginx.org/mailman/listinfo/nginx > <http://mailman.nginx.org/mailman/listinfo/nginx>
_______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx