Hexo 快速开始

1. 安装

1
npm install hexo-cli -g

2. 创建网站

1
2
3
hexo init <项目名>
cd <项目名>
npm install

3. 本地预览

1
hexo server

4. 部署

1. 添加配置

1
2
3
4
5
6
7
8
9
deploy:
type: rsync
host: <host>
user: root
root: /var/www/<域名>/html/
port: 22
delete: true
verbose: true
ignore_errors: false

注: 服务器需提前创建所指定的 root 文件夹

2. Hexo 生成&部署

1
2
3
4
5
hexo generate
hexo deploy
# 或使用以下简化命令
hexo g
hexo d

3. 运行 Nginx

4. 创建文章

1
hexo new <文章名>

另. 更换主题 [可选]

方式一

1
2
npm install hexo-theme-cactus
hexo config theme cactus

方式二

1
2
git submodule add git@github.com:probberechts/hexo-theme-cactus.git themes/cactus
hexo config theme cactus