step1.配置dumi非根目录部署

dumi中配置非根目录部署

  • blog.umirc.ts ```javascript import { defineConfig } from ‘dumi’;

export default defineConfig({ title: ‘Site Name’, mode: ‘site’, // more config: https://d.umijs.org/config // base: ‘/‘, publicPath: ‘/two/‘, exportStatic: {}, // 将所有路由输出为 HTML 目录结构,以免刷新页面时 404 // 其他配置 });

  1. 打包dumi,然后放到下面nginx指定文件夹<br />`npm run build`
  2. <a name="E46OX"></a>
  3. ### step2.配置nginx
  4. ```javascript
  5. http {
  6. server {
  7. location /one {
  8. alias /root/one;
  9. index index.html index.htm;
  10. }
  11. location /two {
  12. alias /root/two;
  13. index index.html index.htm;
  14. }
  15. location /music {
  16. alias /root/music;
  17. index index.html index.htm;
  18. }
  19. }
  20. }

修改配置后要重加载nginx
nginx -s reload