nginx.conf 916 B

123456789101112131415161718192021222324252627282930313233
  1. server {
  2. listen 80;
  3. server_name review.seec.seecoder.cn;
  4. root /usr/share/nginx/html;
  5. index index.html;
  6. # 解决 Vue Router history 模式刷新 404
  7. location / {
  8. try_files $uri $uri/ /index.html;
  9. }
  10. # 静态资源缓存
  11. location ~* \.(js|css|png|svg|ico|woff2?)$ {
  12. expires 7d;
  13. add_header Cache-Control "public, immutable";
  14. }
  15. # 反向代理后端 API,解决 HTTPS 页面请求 HTTP 接口的 Mixed Content 问题
  16. location /api/ {
  17. proxy_pass http://environment-27-33.seec.svc.cluster.local:8080/api/;
  18. proxy_set_header Host $host;
  19. proxy_set_header X-Real-IP $remote_addr;
  20. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  21. proxy_set_header X-Forwarded-Proto $scheme;
  22. }
  23. # 健康检查
  24. location /health {
  25. return 200 "ok";
  26. add_header Content-Type text/plain;
  27. }
  28. }