网站发布:
1.将博客部署到 GitHub Pages 上:
安装插件:
npm install hexo-deployer-git --save
说明:必须安装,否则执行hexo d 的话会报错
编辑博客根目录下_config.yml配置文件,配置远程仓库地址:
deploy:
type: git
repo: github上对应仓库的ssh 链接,也可使用https地址,如:https://github.com/Github用户名/Github用户名.github.io.git
branch: 分支名
在博客根目录下, 将本地 blog 推送到 github仓库
hexo d
推送成功后, 在浏览器中输入对应域名, 即可访问 范同学的小窝 (lunatickrian.github.io)。
指令 | 说明 |
---|---|
hexo clean && hexo g | 清除本地项目并重新生成 (重新部署时使用) |
hexo g | 重新生成 |
Hexo s | 开启本地预览 |
Hexo d | 推送到github |
2.将博客部署到Apache Tomcat或者Nginx上:
通过hexo g
命令生成的都是静态网页,可以把生成的public
目录中的文件,全都拷贝到网站根目录,然后启动apache tomcat或者nginx服务。