nginx.conf 663 B

12345678910111213141516171819202122232425
  1. # 虚拟主机配置(前端 + 反向代理 API)
  2. server {
  3. listen 80; # 监听端口
  4. server_name localhost; # 域名或 IP
  5. user root;
  6. # 前端静态文件
  7. location / {
  8. root /usr/share/nginx/html; # Vue/React 打包后的 dist 目录
  9. index index.html;
  10. try_files $uri $uri/ /index.html; # 支持 Vue/React 前端路由
  11. }
  12. # 后端 API 代理
  13. location /api/v1/ {
  14. proxy_pass http://ruoyi.autumn.com/api/v1/; # 转发到后端服务
  15. }
  16. # 错误页面
  17. error_page 500 502 503 504 /50x.html;
  18. location = /50x.html {
  19. root /usr/share/nginx/html;
  20. }
  21. }