# 虚拟主机配置(前端 + 反向代理 API) server { listen 80; # 监听端口 server_name localhost; # 域名或 IP user root; # 前端静态文件 location / { root /usr/share/nginx/html; # Vue/React 打包后的 dist 目录 index index.html; try_files $uri $uri/ /index.html; # 支持 Vue/React 前端路由 } # 后端 API 代理 location /api/v1/ { proxy_pass http://ruoyi.autumn.com/api/v1/; # 转发到后端服务 } # 错误页面 error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }