Map FastCGI Ports Dynamically

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


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.

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:,222820,222887#msg-222887

More information about the nginx mailing list