bla-stage.domain.tld/var/www/bla-stage?feature-next-stage.domain.tld → /var/www/feature-nextfeature-bla-stage.domain.tld → /var/www/feature-blaserver {
listen 80 default_server;
charset utf-8;
server_name "~^(.*)-stage\.domain\.tld$";
root /var/www/$1;
index index.html index.htm index.php;
...
}server {
listen 80;
server_name ~^([^\-]+\-[^\-]+)\-stage.domain.tld$;
if ($host ~* ^([^\-]+\-[^\-]+)\-stage.domain.tld$) {
set $root_dir $1;
}
location / {
root /var/www/$root_dir
}
}