KuangPF / dumi-theme-antd

A antd site theme package for the dumi framework.
https://kuangpf.com/dumi-theme-antd
MIT License
42 stars 19 forks source link

nginx 部署问题 #24

Closed consistent-k closed 11 months ago

consistent-k commented 11 months ago

使用dumi-theme-antd 主题之后,因为首页只需要通过配置,于是docs文件夹下并没有index.md, 这样的话打包出来的项目是不存在 index.html的, 那么问题来了 之前配好的nginx.conf里的rewrite怎么配置呢,以下是我原始的配置,如果docs下有index.md的话是可以的,但是如果有index.md 就无法使用配置文件了,求助如何解决?

.dumirc.ts 配置文件:

    outputPath: 'docs-dist/static-my-ui',
    base: '/my-ui',
    publicPath: '/static-my-ui/',

nginx.conf

worker_processes  1;
events {
    worker_connections  1024;
}
http{
    server {
        listen  8000;
        absolute_redirect off;
        server_name_in_redirect off;
        port_in_redirect off;

        access_log  /home/work/log/access.log;
        error_log   /home/work/log/error.log;

        include  mime.types;

        # 设置静态资源路径
        root  /home/work/web

        location /my-ui {
            root /home/work/web;
            try_files $uri $uri/ @fallback;
            index index.html;
        }

        location @fallback {
            rewrite ^.*$ /static-my-ui/index.html break;
        }
    }
}