小编flo*_*aun的帖子

try_files 指令中的 $uri 和 $uri/ 有什么区别?

这是配置:

\n
index index.html;\nlocation / {\n    try_files $uri $uri/ = 404;\n}\n
Run Code Online (Sandbox Code Playgroud)\n

我在 http://localhost/path/a/ 发出请求。我假设这是 URI,因此在 $uri 阶段,try_files 将查看 /path/a/ 并提供 index.html(如果有)。

\n

我从文档中读到It is possible to check directory\xe2\x80\x99s existence by specifying a slash at the end of a name, e.g. \xe2\x80\x9c$uri/\xe2\x80\x9d.但这对我来说没有任何意义。

\n

nginx

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

nginx ×1