nginx.conf 841 B

123456789101112131415161718192021222324252627282930313233
  1. server {
  2. listen 80;
  3. server_name _;
  4. # 用户端前端
  5. location / {
  6. root /usr/share/nginx/user;
  7. index index.html;
  8. try_files $uri $uri/ /index.html;
  9. }
  10. # 管理后台前端
  11. location /admin/ {
  12. root /usr/share/nginx;
  13. try_files $uri $uri/ /admin/index.html;
  14. add_header Cache-Control "no-cache, no-store, must-revalidate";
  15. }
  16. # 后端 API(含 OAuth 回调)
  17. location /api/ {
  18. proxy_pass http://backend:8010;
  19. proxy_set_header Host $host;
  20. proxy_set_header X-Real-IP $remote_addr;
  21. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  22. proxy_set_header X-Forwarded-Proto $scheme;
  23. }
  24. # 健康检查
  25. location /health {
  26. proxy_pass http://backend:8010;
  27. proxy_set_header Host $host;
  28. }
  29. }