记录一下 nginx 配置里面 alias / root / proxy_pass 的区别
alias
别名配置, 匹配到的 url 路径会被替换
location /test {
alias /img;
}
请求: /test/1.png
指向: /img/1.png
root
根路径配置, 匹配到的 url 会被拼接到 root 路径之后
location /test {
root /img;
}
请求: /test/1.png
指向: /img/test/1.png
proxy_pass
反向代理, 匹配到的 url 会被转发到 proxy_pass 的 url