Map FastCGI Ports Dynamically
Valentin V. Bartenev
ne at vbart.ru
Wed Feb 22 22:06:08 UTC 2012
On Thursday 23 February 2012 01:16:33 justin wrote:
> Valentin:
>
> Here is a snippet of the config:
>
> server {
> listen 80;
>
> map $user $user_fastcgi_port {
> default 9000;
> bob 9001;
> john 9002;
> kelly 9003;
> }
>
> server_name $user\.my\.domain\.com$;
>
> root /srv/www/users/$user/wp;
>
> index index.php;
>
> access_log /var/log/nginx/users/$user.access.log;
> error_log /var/log/nginx/error.log;
>
> include /etc/nginx/excludes.conf;
> include /etc/nginx/wordpress.conf;
> include /etc/nginx/expires.conf;
> }
>
> I am getting the following error though:
>
> nginx: [emerg] "map" directive is not allowed here in
> /etc/nginx/conf.d/core.conf:4
> 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.
http://wiki.nginx.org/HttpMapModule
wbr, Valentin V. Bartenev
More information about the nginx
mailing list