I have a config file that handles wildcard subdomains like:
server_name ~^(?.+).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.
On Thursday 23 February 2012 01:16:33 justin wrote:
john 9002;
error_log /var/log/nginx/error.log;
nginx: configuration file /etc/nginx/nginx.conf test failed
Yeap, if you look at the documentation, you will see:
map
syntax: map $var1 $var2 { … }
default: none
context: http
Please, notice that “context: http”, therefore you must define “map”
block in
the “http” context, not the “server” one. And error log message is
trying to
give a hint.
On Thursday 23 February 2012 05:28:04 justin wrote:
justin 9001;
simon 9002;
}
}
server {
Set’s $user
server_name ~^(?.+).my.domain.com$;
}
Did you try, or it’s just your guess? There’s no “variable scope”
concept in
nginx configuration. And it mostly has declarative nature, therefore,
the order
of most directives is not important, unless it is specifically
documented.
btw, your example config also wrong. If look at the documentation, you
will see:
server
syntax: server { … }
default: —
context: http