nginx.conf 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # DRG医保控费预警系统 - Nginx 配置
  2. # 适用于 Windows Server 2019
  3. worker_processes 1;
  4. events {
  5. worker_connections 1024;
  6. }
  7. http {
  8. include mime.types;
  9. default_type application/octet-stream;
  10. sendfile on;
  11. keepalive_timeout 65;
  12. # 前端应用服务器
  13. server {
  14. listen 80;
  15. server_name localhost;
  16. # 前端静态文件根目录(根据实际部署路径调整)
  17. root html/dist;
  18. index index.html index.htm;
  19. # 启用 gzip 压缩
  20. gzip on;
  21. gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
  22. # API 代理 - 使用精确匹配
  23. location = /iris-api/invoke {
  24. proxy_pass http://111.229.137.113:52773/csp/drg/sysInternalMutiple;
  25. proxy_set_header Host $host;
  26. proxy_set_header X-Real-IP $remote_addr;
  27. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  28. }
  29. # 处理 React Router - 所有请求都返回 index.html
  30. location / {
  31. try_files $uri $uri/ /index.html;
  32. }
  33. # 静态资源缓存
  34. location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
  35. expires 1y;
  36. add_header Cache-Control "public, immutable";
  37. }
  38. # 错误页面
  39. error_page 500 502 503 504 /50x.html;
  40. location = /50x.html {
  41. root html;
  42. }
  43. }
  44. }