- 原先 location / 的 301 重定向拦截了所有请求,导致 /css/ 和 /img/ 无法访问 - 添加独立的 /css/ 和 /img/ location 块,确保静态资源正常加载
This commit is contained in:
+11
-2
@@ -4,13 +4,22 @@ server {
|
|||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
|
# 共享静态资源
|
||||||
|
location /css/ {
|
||||||
|
alias /usr/share/nginx/html/css/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /img/ {
|
||||||
|
alias /usr/share/nginx/html/img/;
|
||||||
|
}
|
||||||
|
|
||||||
# 主简历
|
# 主简历
|
||||||
location /resume/ {
|
location /resume/ {
|
||||||
alias /usr/share/nginx/html/resume/;
|
alias /usr/share/nginx/html/resume/;
|
||||||
try_files $uri $uri/ /resume/index.html;
|
try_files $uri $uri/ /resume/index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
# 其他简历导航
|
# 其他简历导航页
|
||||||
location /other/ {
|
location /other/ {
|
||||||
alias /usr/share/nginx/html/other/;
|
alias /usr/share/nginx/html/other/;
|
||||||
try_files $uri $uri/ /other/index.html;
|
try_files $uri $uri/ /other/index.html;
|
||||||
@@ -28,7 +37,7 @@ server {
|
|||||||
try_files $uri $uri/ /other/security-engineer/index.html;
|
try_files $uri $uri/ /other/security-engineer/index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
# 默认路由(重定向到主简历)
|
# 根路径重定向到主简历
|
||||||
location / {
|
location / {
|
||||||
return 301 /resume/;
|
return 301 /resume/;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user