# DRG医保控费预警系统 - Nginx 配置 # 适用于 Windows Server 2019 worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; # 前端应用服务器 server { listen 80; server_name localhost; # 前端静态文件根目录(根据实际部署路径调整) root html/dist; index index.html index.htm; # 启用 gzip 压缩 gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; # API 代理 - 使用精确匹配 location = /iris-api/invoke { proxy_pass http://111.229.137.113:52773/csp/drg/sysInternalMutiple; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } # 处理 React Router - 所有请求都返回 index.html location / { try_files $uri $uri/ /index.html; } # 静态资源缓存 location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; } # 错误页面 error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }