1、alias 配置:
location /resources/image/ {
alias /local_path/image/;
}
# 访问:http://127.0.0.1/resources/image/test.png
# 定位资源路径为:/local_path/image/test.png
2、root 配置:
location /resources/image/ {
root /local_path/image/;
}
# 访问:http://127.0.0.1/resources/image/test.png
# 定位资源路径为:/local_path/image/resources/image/test.png
如上,alias 会把 location 的值替换掉,而 root 会拼接上 location 的值。