ngx_http_map_module

Cliff Wells cliff at develix.com
Wed Nov 21 13:10:06 MSK 2007


I saw this module mentioned on IRC and thought I'd give it a try.  


http {

    map $http_host $backend {
        hostnames;
        default          http://127.0.0.1:8000;
        .domain1.com     http://127.0.0.2:8000;
        .domain2.com     http://127.0.0.3:8000;
        # ...
    }


    server {
        server_name     domain1.com www.domain1.com;
        listen          198.145.247.210:80;
        location / {
            proxy_pass    $backend;
            include       /etc/nginx/proxy.conf;
        }
    }


    server {
        server_name     domain2.com www.domain2.com;
        listen          198.145.247.210:80;
        location / {
            proxy_pass    $backend;
            include       /etc/nginx/proxy.conf;
        }
    }

    # ...
}


But this fails to load with "invalid URL prefix".  Is it not possible to
use variables in proxy_pass directive or am I doing something else
wrong?


Regards,
Cliff






More information about the nginx mailing list