Map FastCGI Ports Dynamically

justin nginx-forum at
Wed Feb 22 21:16:33 UTC 2012


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
nginx: configuration file /etc/nginx/nginx.conf test failed

Posted at Nginx Forum:,222820,222874#msg-222874

More information about the nginx mailing list