docs: add README with startup and deployment guide
This commit is contained in:
parent
3ca6fa4b8b
commit
16c6279484
59
README.md
Normal file
59
README.md
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# OneinAI 文档站
|
||||||
|
|
||||||
|
基于 VitePress 构建的文档站点。
|
||||||
|
|
||||||
|
## 本地启动
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 安装依赖
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# 启动开发服务器
|
||||||
|
npm run docs:dev
|
||||||
|
```
|
||||||
|
|
||||||
|
访问 http://localhost:5173 查看效果。
|
||||||
|
|
||||||
|
## 构建
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run docs:build
|
||||||
|
```
|
||||||
|
|
||||||
|
构建产物在 `apidoc/.vitepress/dist/` 目录。
|
||||||
|
|
||||||
|
## 部署到宝塔
|
||||||
|
|
||||||
|
### 1. 本地构建
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run docs:build
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 宝塔添加站点
|
||||||
|
|
||||||
|
1. 宝塔面板 → **网站** → **添加站点**
|
||||||
|
2. 填写域名,PHP 版本选 **纯静态**
|
||||||
|
3. 记住站点根目录路径(如 `/www/wwwroot/你的域名/`)
|
||||||
|
|
||||||
|
### 3. 上传文件
|
||||||
|
|
||||||
|
将本地 `apidoc/.vitepress/dist/` 目录下的**所有文件**上传到站点根目录。
|
||||||
|
|
||||||
|
可使用宝塔文件管理器或 FTP 工具上传。
|
||||||
|
|
||||||
|
### 4. 配置 Nginx
|
||||||
|
|
||||||
|
进入站点 **设置 → 配置文件**,找到 `location /` 块,修改为:
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
保存后重载 Nginx,站点即可正常访问。
|
||||||
|
|
||||||
|
### 5. 后续更新
|
||||||
|
|
||||||
|
每次修改文档后重新执行构建,将新的 `dist/` 内容覆盖上传即可。
|
||||||
Loading…
x
Reference in New Issue
Block a user