feat: 更新 Nginx 配置以支持新的网页和后台管理端路径
- 修改根路径重定向至网页端的 index.html。 - 新增网页端和后台管理端的路径配置,确保静态资源正确加载。 - 优化了静态文件查找和代理逻辑,提升了请求处理效率。
This commit is contained in:
31
ngnix.conf
31
ngnix.conf
@@ -1,20 +1,8 @@
|
||||
# Nginx 静态文件服务 + 智能代理
|
||||
|
||||
server {
|
||||
# 静态资源根目录
|
||||
# 静态资源根目录(dist)
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
# 前端资源路径别名(/sys/ -> /)
|
||||
location /sys/ {
|
||||
alias /usr/share/nginx/html/;
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
# 根路径固定进入前端,避免落到后端登录页
|
||||
location = / {
|
||||
return 302 /sys/;
|
||||
}
|
||||
|
||||
index index.html;
|
||||
|
||||
# SSL 配置
|
||||
@@ -24,6 +12,23 @@ server {
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
|
||||
# 根路径默认进入网页端
|
||||
location = / {
|
||||
return 302 /web/index.html;
|
||||
}
|
||||
|
||||
# 网页端(public/web/index.html -> dist/web/index.html)
|
||||
location /web/ {
|
||||
alias /usr/share/nginx/html/web/;
|
||||
try_files $uri $uri/ /web/index.html;
|
||||
}
|
||||
|
||||
# 后台管理端(dist/index.html,前缀 /sys/)
|
||||
location /sys/ {
|
||||
alias /usr/share/nginx/html/;
|
||||
try_files $uri $uri/ /sys/index.html;
|
||||
}
|
||||
|
||||
# 1. 先尝试作为静态文件查找
|
||||
location / {
|
||||
try_files $uri $uri/ @proxy;
|
||||
|
||||
Reference in New Issue
Block a user