From ac1753d643abadb2af20a0481a4224b5f55c22e9 Mon Sep 17 00:00:00 2001 From: wonder Date: Thu, 27 Aug 2026 18:48:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=20css=20=E5=92=8C=20i?= =?UTF-8?q?mg=20=E7=9A=84=20nginx=20location=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 原先 location / 的 301 重定向拦截了所有请求,导致 /css/ 和 /img/ 无法访问 - 添加独立的 /css/ 和 /img/ location 块,确保静态资源正常加载 --- nginx.conf | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/nginx.conf b/nginx.conf index 93bb937..cc50542 100644 --- a/nginx.conf +++ b/nginx.conf @@ -4,13 +4,22 @@ server { root /usr/share/nginx/html; index index.html; + # 共享静态资源 + location /css/ { + alias /usr/share/nginx/html/css/; + } + + location /img/ { + alias /usr/share/nginx/html/img/; + } + # 主简历 location /resume/ { alias /usr/share/nginx/html/resume/; try_files $uri $uri/ /resume/index.html; } - # 其他简历导航 + # 其他简历导航页 location /other/ { alias /usr/share/nginx/html/other/; try_files $uri $uri/ /other/index.html; @@ -28,7 +37,7 @@ server { try_files $uri $uri/ /other/security-engineer/index.html; } - # 默认路由(重定向到主简历) + # 根路径重定向到主简历 location / { return 301 /resume/; }