fix(OpenResty): correct regex escaping for dotfiles & assets

- Use `\.` instead of `\\.` so file extensions and hidden dotfiles are matched correctly.
This commit is contained in:
Haitao Pan 2025-08-18 11:51:35 +08:00
parent 3f6faff10f
commit a02d2c8196

View File

@ -30,7 +30,7 @@ server {
try_files $uri =404; try_files $uri =404;
} }
location ~ /\\. { location ~ /\. {
deny all; deny all;
} }
} }
@ -110,14 +110,14 @@ server {
} }
# 静态资源缓存 # 静态资源缓存
location ~* \\.(?:ico|css|js|gif|jpe?g|png|woff2?)$ { location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?)$ {
expires 30d; expires 30d;
access_log off; access_log off;
add_header Cache-Control "public"; add_header Cache-Control "public";
} }
# 隐藏 . 文件 # 隐藏 . 文件
location ~ /\\. { location ~ /\. {
deny all; deny all;
} }
} }