vuePreee 部署技术文档

mkdir api-doc
cd api-doc
npm install -D vuepress

mkdir docs
npx vuepress dev docs

#生成 package.json
npm init -y

#添加编译脚本
vim package.json
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "docs:dev": "vuepress dev docs",
    "docs:build": "vuepress build docs"
  }

cd docs
mkdir .vueprss

vim config.json
module.exports = {
    title: 'xxx小程序 API',
    dest: 'doc_dist',
    themeConfig: {
        sidebar: [
            {
                title: '试听申请',
                collapsable: false,
                children: [
                    '/FreeAuditionController/sms.md',
                    '/FreeAuditionController/sms_submit.md',
                ]
            }
        ]
    }
}

在 docs下编写文档

mkdir FreeAuditionController
cd FreeAuditionController
vim sms.md
....省略

编译生成静态网页doc_dist目录下

nginx配置

jiyang.node ➜  doc_dist cat /etc/nginx/nginx.conf
user root;
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    charset utf-8;        # 设置编码格式

    server {
        listen 8081;             # 端口号
        server_name _;           # 配置域名信息
        root /root/meisiVuePress/doc_dist;  # 静态页面根目录
        index index.html;
    }
}

访问 http://172.16.0.95:8081/

你可能感兴趣的:(【工具】Linux)