Map FastCGI Ports Dynamically

justin nginx-forum at nginx.us
Thu Feb 23 01:28:04 UTC 2012


Valentin,

Ok, well I am almost there. The problem is since we need to define the
map block outside of server, the $user variable is not defined yet.
I.E.

http {
  # $user is not defined yet, it comes from inside server {}
  map $user $user_fastcgi_port {
    default 9000;
    justin 9001;
    simon 9002;
  }
}

server {
  # Set's $user
  server_name ~^(?<user>.+)\.my\.domain\.com$;
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,222820,222887#msg-222887



More information about the nginx mailing list