nginx的alias与root的区别

root的写法:

location /request_path/image/ {
    root /local_path/image/;
}

这样配置的结果就是当客户端请求 /request_path/image/cat.png 的时候, Nginx把请求映射为/local_path/image/request_path/image/cat.png。

alias的写法:

location /request_path/image/ {
    alias /local_path/image/;
}

这时候,当客户端请求 /request_path/image/cat.png 的时候, Nginx把请求映射为/local_path/image/cat.png。

posted @ 2019-09-23 15:08  在谷歌上百度  阅读(221)  评论(0编辑  收藏  举报