nginx.conf 623 B

123456789101112131415161718192021222324252627
  1. server {
  2. listen 80;
  3. server_name localhost;
  4. root /usr/share/nginx/html;
  5. index index.html;
  6. # 前端路由支持
  7. location / {
  8. try_files $uri $uri/ /index.html;
  9. }
  10. # API 代理
  11. location /api/ {
  12. proxy_pass http://backend:8010;
  13. proxy_set_header Host $host;
  14. proxy_set_header X-Real-IP $remote_addr;
  15. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  16. proxy_set_header X-Forwarded-Proto $scheme;
  17. }
  18. # 健康检查代理
  19. location /health {
  20. proxy_pass http://backend:8010;
  21. proxy_set_header Host $host;
  22. }
  23. }