【发布时间】:2018-05-09 02:08:52
【问题描述】:
在研究nginx位置配置的时候,有一些疑问,下面是我的例子。
文件结构如下: test1/index.html test2/index.html
nginx.conf 的位置部分如下:
location = / {
root test1;
index index.html;
# deny all;
}
location / {
root test2;
index index.html;
}
问题是,当我发出 curl -v http://host/ 时,我得到了 test2/index.html 的页面,但是当我去掉 location = / {} 部分中的 # 时, 结果将是 403 禁止。谁能解释为什么?当 location = same_uri {A} 和 location same_uri {B} 都在配置文件中时,哪个配置将匹配[A 或 B]?非常感谢。
http://nginx.org/en/docs/http/ngx_http_core_module.html#location
【问题讨论】:
标签: nginx