天天看點

nginx虛拟目錄配置root和alias

配置nginx虛拟目錄是要注意root配置的并非為完整路徑,nginx會組合root和location的路徑。

location /image/ {
          root /data/;
    }
           

在這種配置下,當http://192.168.9.1/image/20161031.png通路時就被指定的是http://192.168.9.1/data/image/20161031.png

location /web {
         alias /deploy/dev/work_01/project
    }
           

alias是别名的意思,在這種配置下,當http://192.168.9.1/web/1.html通路時就被指定的是http://192.168.9.1//deploy/dev/work_01/project/1.html

繼續閱讀