sample.com/ ->指向 資料夾A
sample.com/web ->指向 資料夾B
sample.com/config.json 自動覆寫使用不同 json
root /data/forder1;
location = /web {
return 301 /web/;
}
location ^~ /web/ {
alias /data/forder2/;
index index.html;
try_files $uri $uri/ /index.html;
}
location = /config.json {
if ($host ~* "^www\.sample\.com$|^sample\.com$") {
rewrite ^ /config-sample.com.json last;
}
root /data/forder1;
}
sample.com/ ->指向 資料夾A
sample.com/h5 ->指向 資料夾B
sample.com/h5/config.json 自動覆寫使用不同 json
root /data/forder1;
location = /h5 {
return 301 /h5/;
}
location ^~ /h5/ {
alias /data/forder2/;
index index.html;
try_files $uri $uri/ /index.html;
}
location = /h5/config.json {
if ($host = "bax-max.com") {
rewrite ^ /config-bax-max.com.json break;
}
root /data/forder2;
try_files $uri =404;
}