diff --git a/docker/wvp/web/conf/nginx.conf b/docker/wvp/web/conf/nginx.conf index fe25844..b64309d 100644 --- a/docker/wvp/web/conf/nginx.conf +++ b/docker/wvp/web/conf/nginx.conf @@ -14,20 +14,7 @@ http { listen 80; server_name localhost; - location / { - root /home/ruoyi/projects/wvp-ui; - try_files $uri $uri/ /index.html; - index index.html index.htm; - } - - # 前端静态资源(CSS、JS、图片等) - location /static/ { - root /home/ruoyi/projects/wvp-ui; - expires 30d; - access_log off; - } - - # WVP 后端 API 代理 + # WVP 后端 API 代理(优先匹配) location /api/ { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; @@ -55,6 +42,20 @@ http { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } + # 前端静态资源(CSS、JS、图片等) + location /static/ { + root /home/ruoyi/projects/wvp-ui; + expires 30d; + access_log off; + } + + # 前端页面(最后匹配) + location / { + root /home/ruoyi/projects/wvp-ui; + try_files $uri $uri/ /index.html; + index index.html index.htm; + } + # 避免actuator暴露 if ($uri ~ "/actuator") { return 403;