# Risk-Guard 本项目基于 [Ant Design Pro](https://pro.ant.design) 的阿里开源模板二开, Ant Design Pro 则使用了 React, UmiJS, Ant Design等技术栈. ## 安装依赖 安装 `node_modules`: ```bash pnpm i ``` 或者使用 `yarn` 或 `npm` 安装依赖。 ### 启动项目 ```bash pnpm start ``` ### 构建项目 ```bash pnpm build ``` ## 更多信息 您可以在 [官方网站](https://pro.ant.design) 查看完整文档。 由于项目路由使用history模式,需要配置nginx,否则刷新页面会404,并且用了sse接口,也需要一些特殊配置。 ```nginx server { listen 80; # server_name your-domain.com; # 安全头 add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; add_header X-XSS-Protection "1; mode=block" always; root /data/react; index index.html; # 首页协商缓存 location = /index.html { add_header Cache-Control "no-cache"; } # 静态资源 location ~* \.(?:js|css|woff2?|eot|ttf|svg|ico|png|jpg|jpeg|gif|webp)$ { gzip on; gzip_min_length 10k; gzip_types application/javascript text/plain application/x-javascript text/css application/xml text/javascript; gzip_comp_level 6; expires 1d; add_header Cache-Control "public, immutable"; } # SPA路由 location / { try_files $uri $uri/ /index.html; } # SSE接口 location = /api/sse/connect { proxy_http_version 1.1; proxy_set_header Connection ''; proxy_set_header Cache-Control "no-transform"; proxy_set_header X-Accel-Buffering "no"; proxy_buffering off; proxy_read_timeout 86400s; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto $scheme; # 路径重写 rewrite ^/api(/.*)$ $1 break; proxy_pass http://127.0.0.1:8090; } # API代理 location /api/ { # 路径重写 rewrite ^/api(/.*)$ $1 break; gzip on; gzip_types application/json; gzip_comp_level 6; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://127.0.0.1:8090; } } ```