nginx.conf 720 B

1234567891011121314151617181920212223242526272829
  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. alias /usr/share/nginx/html/favicon.ico;
  13. }
  14. # 后端 API 代理
  15. location /api/v1/ {
  16. proxy_pass http://ruoyi.autumn.com/api/v1/; # 转发到后端服务
  17. }
  18. # 错误页面
  19. error_page 500 502 503 504 /50x.html;
  20. location = /50x.html {
  21. root /usr/share/nginx/html;
  22. }
  23. }