Map FastCGI Ports Dynamically
Valentin V. Bartenev
ne at vbart.ru
Wed Feb 22 08:05:56 UTC 2012
On Wednesday 22 February 2012 06:58:09 justin wrote:
> I have a config file that handles wildcard subdomains like:
>
> server_name ~^(?<user>.+)\.mydomain\.com$;
>
> Then the variable $user contains the subdomain. The problem, is that I
> also need to dynamically set the port that fastcgi passes PHP work too
> since each user has their own PHP-FPM pool.
>
> fastcgi_pass php1.local.mydomain.com:XXXX;
>
> Is there a way to setup a hashmap of something like:
>
> user fastcgi-port
> -------- ---------------
> bob 9001
> john 9002
> kelly 9003
>
> So that nginx can do some magic like:
>
> set $user_port = map($user);
>
> fastcgi_pass php1.local.mydomain.com:$user_port;
>
Do you know about the "map" directive?
http://wiki.nginx.org/HttpMapModule
wbr, Valentin V. Bartenev
More information about the nginx
mailing list