Answer the question
In order to leave comments, you need to log in
How to setup folder and domain in nginx?
Hey!
Available:
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;
...
}
Answer the question
In order to leave comments, you need to log in
server {
listen 80;
server_name ~^(?<root_dir>.*)-stage\.domain\.tld$;
root /var/www/$root_dir;
...
}
server {
listen 80;
server_name ~^([^\-]+\-[^\-]+)\-stage.domain.tld$;
if ($host ~* ^([^\-]+\-[^\-]+)\-stage.domain.tld$) {
set $root_dir $1;
}
location / {
root /var/www/$root_dir
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question