bla-stage.domain.tld
/var/www/bla
-stage
?feature-next-stage.domain.tld
→ /var/www/feature-next
feature-bla-stage.domain.tld
→ /var/www/feature-bla
server {
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
}
}