nginx----alias与root的区别

在nginx中经常用alias和root来开放本地目录提供访问

但是alias跟root是有区别的,他们的区别在于nginx怎么识别并转发他们。

例如对于一个标签test

 

alias:

location /test/ {

    alias /a/b/c/

}

 

root:

location /test/ {

    root  /a/b/c/

}

 

当客户端访问 http://ip/test/index.html 时

对于alias来说,实际上是访问/a/b/c/下面的index.html文件。

对于root来说,实际是是访问/a/b/c/test/下面的index.html文件。

posted @ 2019-01-17 15:55  喜欢it的小聪聪  阅读(127)  评论(0编辑  收藏  举报