I have several domain names and several document root, like that :
toto.exemple.com /var/www/exempleOne
titi.exemple.com /var/www/exempleTwo
[...]
Basically what I want to do, is using only one server block / vhost file for all the domains.
I tried to used nginx map for this, and did the following :
map $host $docroot{
toto.exemple.com /var/www/exempleOne;
titi.exemple.com /var/www/exempleTwo;
}
server {
listen 80;
server_name _;
location / {
root $docroot;
expires 30d;
}
}
But it doesn't seem to work, it seems like nginx is using the default document root (/etc/nginx/html/).