nginx.conf 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # DRG医保控费预警系统 - Nginx 配置(生产真实配置,2026-09-12 同步)
  2. # 适用于 Windows Server 2019
  3. # 前端对外端口 8082;8081 反代本机 80 端口(承载其它业务系统)
  4. worker_processes 1;
  5. events {
  6. worker_connections 1024;
  7. }
  8. http {
  9. include mime.types;
  10. default_type application/octet-stream;
  11. sendfile on;
  12. keepalive_timeout 65;
  13. # 前端应用服务器
  14. server {
  15. listen 8082;
  16. server_name localhost;
  17. # 前端静态文件根目录
  18. root E:\DRG\dist;
  19. index index.html index.htm;
  20. # 启用 gzip 压缩
  21. gzip on;
  22. gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
  23. # API 代理 - 使用精确匹配
  24. # 超时说明:HIS 数据同步(02010067)在大数据量下单次调用可能耗时数分钟,
  25. # nginx 默认 proxy_read_timeout(60s) 会提前断开返回 504,
  26. # 故放宽到 600s,与 src.External.Service 中 httprequest.Timeout = 600 对齐。
  27. # 注意:IRIS 侧 Web Gateway(52773)的 Server Response Timeout 默认 300s,需同步调大,否则仍会断。
  28. location = /iris-api/invoke {
  29. proxy_pass http://127.0.0.1:52773/csp/drg/sysInternalMutiple;
  30. proxy_set_header Host $host;
  31. proxy_set_header X-Real-IP $remote_addr;
  32. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  33. proxy_read_timeout 600s;
  34. }
  35. # API 代理 - 使用精确匹配(带 /dipapp 前缀,与前端 request.ts baseURL = '/dipapp/iris-api' 一致)
  36. # 该 location 必须存在,否则请求会落到 location / 被 try_files 当静态文件处理,返回 405
  37. location = /dipapp/iris-api/invoke {
  38. proxy_pass http://127.0.0.1:52773/csp/drg/sysInternalMutiple;
  39. proxy_set_header Host $host;
  40. proxy_set_header X-Real-IP $remote_addr;
  41. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  42. proxy_read_timeout 600s;
  43. }
  44. # 处理 React Router - 所有请求都返回 index.html
  45. location / {
  46. try_files $uri $uri/ /index.html;
  47. }
  48. # 静态资源缓存
  49. location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
  50. expires 1y;
  51. add_header Cache-Control "public, immutable";
  52. }
  53. # 错误页面
  54. error_page 500 502 503 504 /50x.html;
  55. location = /50x.html {
  56. root html;
  57. }
  58. }
  59. # 反代本机 80 端口(其它业务系统占用 80,经此端口对外)
  60. server {
  61. listen 8081;
  62. server_name localhost;
  63. location / {
  64. proxy_set_header Connection keep-alive;
  65. proxy_pass http://127.0.0.1/;
  66. proxy_set_header X-Real-IP $remote_addr;
  67. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  68. proxy_connect_timeout 20;
  69. proxy_send_timeout 90;
  70. proxy_read_timeout 600s;
  71. proxy_buffering off;
  72. keepalive_timeout 65;
  73. keepalive_requests 500;
  74. proxy_http_version 1.1;
  75. client_max_body_size 10m;
  76. }
  77. }
  78. }