aa0660 发表于 2016-12-27 10:19:31

Nginx 配置中location root 的注意事项

  在配置Nginx服务的时候,可以给不同的uri访问指向不同的位置,例如下面的配置:

server {
listen       80;
server_namewww.xx.com;
location / {
root   D:/www;      #定义默认根目录位置(windows系统)
index index.php index.html index.htm;   #定义首页索引文件的名称
}
location /abc {
root   D:/files/xx;      #定义其他请求的根目录位置(windows系统)
index index.php index.html index.htm;   #定义首页索引文件的名称
}
}
  这里的默认路径没有问题,而/abc这个路径要想正常访问,在“D:/files/xx”目录下还需要有一个abc目录,否则会抛出404异常
页: [1]
查看完整版本: Nginx 配置中location root 的注意事项