Welcome! Log In Create A New Profile

Advanced

variable map for fastcgi_pass

Kyle Sloan
September 25, 2017 03:14PM
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.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

variable map for fastcgi_pass

Kyle Sloan September 25, 2017 03:14PM

Re: variable map for fastcgi_pass

Sergey Kandaurov September 25, 2017 05:14PM

Re: variable map for fastcgi_pass

Kyle Sloan September 25, 2017 05:18PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 127
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