我让 nginx 提供从 uri 路径映射到文件夹路径的静态文件,例如:
www.tempuri.org/js <=> /var/www/plublic/js
www.tempuri.org/css <=> /var/www/plublic/css
www.tempuri.org/img <=> /var/www/plublic/img
www.tempuri.org/foobar <=> /var/www/plublic/foobar
在我的 nginx conf 中,这个规则基本上都具有相同的根:
location /js/ {
root /var/www/public/;
}
location /css/ {
root /var/www/public/;
}
location /foobar/ {
root /var/www/public/;
}
location /img/ {
root /var/www/public/;
}
如何为所有 4 条路径编写一条规则?
location /(css|js|img|foobar)/ {
root /var/www/public
}
?