From bf6adb0d865aa88645d5f455d917400a6345cd62 Mon Sep 17 00:00:00 2001 From: shenlan Date: Mon, 18 Aug 2025 13:01:25 +0800 Subject: [PATCH] roles/vhosts/OpenResty: fix regex escaping for dot files --- playbooks/roles/vhosts/OpenResty/templates/site.conf.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/playbooks/roles/vhosts/OpenResty/templates/site.conf.j2 b/playbooks/roles/vhosts/OpenResty/templates/site.conf.j2 index 2b1c223..c56910d 100644 --- a/playbooks/roles/vhosts/OpenResty/templates/site.conf.j2 +++ b/playbooks/roles/vhosts/OpenResty/templates/site.conf.j2 @@ -30,7 +30,7 @@ server { try_files $uri =404; } - location ~ /\\. { + location ~ /\. { 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; access_log off; add_header Cache-Control "public"; } # 隐藏 . 文件 - location ~ /\\. { + location ~ /\. { deny all; } }