【发布时间】:2016-11-29 15:35:30
【问题描述】:
我在一些要点和配置示例中发现了一个 nginx 配置 sn-p(主要用于 PHP 应用程序):
#site root is redirected to the app boot script
location = / {
try_files @site @site;
}
#all other locations try other files first and go to our front controller if none of them exists
location / {
try_files $uri $uri/ @site;
}
但我就是不明白:第一个 try_files 指令是否匹配?对我来说,这看起来像是一些无意义的黑客行为。
请确认或解释为什么不 - 谢谢:)
【问题讨论】:
-
无条件跳转到@site 是一种技巧。就个人而言,我更喜欢
error_page变体。见this answer。
标签: nginx