如何在location指令中提供单个文件?

use*_*922 10 nginx

如何在location指令中返回单个文件而不进行任何回退?try_files至少需要两个.这看起来很简单,但我在文档或示例中找不到它.

location / {
      try_files one_file; # => wrong number of parameters
}
Run Code Online (Sandbox Code Playgroud)

Dan*_*ack 13

最简单的方法是在文件不存在时使用重定向到错误代码的能力.

location / {
      try_files /theOnlyFile.html =404;
}
Run Code Online (Sandbox Code Playgroud)