mirror of
https://gitee.com/docsifyjs/docsify.git
synced 2024-12-09 23:47:41 +08:00
59 lines
1.3 KiB
Markdown
59 lines
1.3 KiB
Markdown
# 部署
|
|
|
|
和 GitBook 生成的文档一样,我们可以直接把文档网站部署到 GitHub Pages 或者 VPS 上。
|
|
|
|
## GitHub Pages
|
|
|
|
GitHub Pages 支持从三个地方读取文件
|
|
- `docs/` 目录
|
|
- master 分支
|
|
- gh-pages 分支
|
|
|
|
我们推荐直接将文档放在 `docs/` 目录下,在设置页面开启 **GitHub Pages** 功能并选择 `master branch /docs folder` 选项。
|
|
|
|
![github pages](_images/deploy-github-pages.png)
|
|
|
|
!> 可以将文档放在根目录下,然后选择 **master 分支** 作为文档目录。
|
|
|
|
|
|
## GitLab Pages
|
|
|
|
If you are deploying your master branch, include `.gitlab-ci.yml` with the following script:
|
|
|
|
?> The `.public` workaround is so `cp` doesn't also copy `public/` to itself in an infinite loop.
|
|
|
|
``` YAML
|
|
pages:
|
|
stage: deploy
|
|
script:
|
|
- mkdir .public
|
|
- cp -r * .public
|
|
- mv .public public
|
|
artifacts:
|
|
paths:
|
|
- public
|
|
only:
|
|
- master
|
|
```
|
|
|
|
!> You can replace script with `- cp -r docs/. public`, if `./docs` is your Docsify subfolder.
|
|
|
|
|
|
## VPS
|
|
|
|
和部署所有静态网站一样,只需将服务器的访问根目录设定为 `index.html` 文件。
|
|
|
|
例如 nginx 的配置
|
|
|
|
```nginx
|
|
server {
|
|
listen 80;
|
|
server_name your.domain.com;
|
|
|
|
location / {
|
|
alias /path/to/dir/of/docs;
|
|
index index.html;
|
|
}
|
|
}
|
|
```
|