快速搭建vuepress文档linux

安装vitepres

npm add -D vitepress

输入命令安装

npx vitepress init

开始配置

┌  Welcome to VitePress!
│
◇  Where should VitePress initialize the config?
│  ./docs   //文档的路径
│
◇  Site title:
│  My Awesome Project //标题
│
◇  Site description:
│  A VitePress Site //描述
│
◆  Theme: //风格
│  ● Default Theme (Out of the box, good-looking docs) //默认
│  ○ Default Theme + Customization // 默认+自定义
│  ○ Custom Theme //自定义
└

目录结构

docs下存放着文档信息和.vitepress的路由配置

部署linux

.vitepress下的base:"/"

server {
    gzip on;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    listen 8090; #端口
    server_name _;
    index index.html;

    location / {
        # content location
        root /home/web/docs; #文档的存放在路径

        # exact matches -> reverse clean urls -> folders -> not found
        try_files $uri $uri.html $uri/ =404;

        # non existent pages
        error_page 404 /404.html;

        # a folder without index.html raises 403 in this setup
        error_page 403 /404.html;

        # adjust caching headers
        # files in the assets folder have hashes filenames
        location ~* ^/assets/ {
            expires 1y;
            add_header Cache-Control "public, immutable";
        }
    }
}

最后是成果

在线预览 cy-docs

giteelichaoyang/cy-docsicon-default.png?t=O83Ahttps://gitee.com/Yang_02/cy-docs

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值