precontent 阶段的 try_files 指令;
- ngx_http_try_files_module 模块;
- 功能: 依次试图访问多个 url 对应的文件(由 root 或者 alias 指令指定),当文件存在时,直接返回文件内容,如果所有文件都不存在,则按最后一个URL 结果或者code返回.
try_files
:- syntax: try_files file…uri; / try_files file… =code;
- default: –
- context: server, location
示例配置:
server {
server_name tryfiles.go.com;
error_log logs/myerror.log info;
root html;
location /first {
try_files /system/maintenance.html $uri $uri/ind