diff --git a/content/post/nginx.md b/content/post/nginx.md index 3586b7d..9e49931 100644 --- a/content/post/nginx.md +++ b/content/post/nginx.md @@ -72,9 +72,20 @@ categories: ["web"] - / 通用匹配,可匹配任何请求,匹配后继续向下搜索 ## try_files -- try_files {file} ... {uri} -- try_files {file} ... ={code} -- try_files {file} ... {location_name} +- 未找到这四个文件时,跳转到 url:/a/b/c + ``` + try_files file1 file2 file3 file4 /a/b/c; + ``` + +- 未找到文件或目录时返回 403 + ``` + try_files file1 dir2/ =403; + ``` + +- 直接跳转到 location @app + ``` + try_files _ @app; + ``` ## 客户端访问控制 - deny all 拒绝全部访问