本地搭建完成只是一个开始,想要真正的用起来当然少不了部署了。


部署到服务器

1
npm install hexo-deployer-git --save
  • 修改_config.yml配置
1
2
3
4
5
deploy:
type: git
repo: 仓库地址 repository
branch: 分支
message: 提交信息
  • 生成站点文件并推送至远程库。
1
hexo clean && hexo deploy

前者清除站点文件,后者重新生成站点文件并将之推送到指定的库分支。

配置nginx

  • 打开nginx配置文件,新增一个server
1
2
3
4
5
6
7
8
9
server {
listen 80;
server_name www.wxy.email; 域名
charset utf-8;
location / {
root /home/blog; 服务器上的代码目录路径
index index.html;
}
}
  • 重启nginx
shell
1
service nginx reload
  • 这样就OK了,简单到意外…