nginx.conf 642 B

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