root:
指定资源访问根路径,如下。如果请求资源/regpatten/for/resoureces/xxx.res,所请求到的资源实际路径为:/nginx/root/path/regpatten/for/resoureces/xxx.res
location /regpatten/for/resoureces {
root /nginx/root/path;
}
alias:
指定替代地址,可以理解为root/匹配到路径.
所以,请求资源/regpatten/for/resoureces/xxx.res,实际路径为:/nginx/root/path/xxx.res。
location /regpatten/for/resoureces {
alias /nginx/root/path/;
}
注意:在配置上:
(1)alias 只配置在location中
(2)alias 必须以“/”结尾