使用hexo+GitHub+阿里云搭建个人网站

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xingfuzhijianxia/article/details/85342336

使用hexo+GitHub+阿里云搭建个人网站

1. 关于hexo

以下为hexo文档连接地址
https://hexo.io/zh-cn/docs/

2. 安装node和git

请自行从网上查找适合自己系统和版本进行安装。

2.1 node安装

node下载 https://nodejs.org/zh-cn/
配置好Node.js环境

2.2 git安装

git 下载 https://git-scm.com/download

3. Hexo

3.1 安装与启动部署

npm install -g hexo-cli  //hexo插件安装
hexo init blob //初始化hexo文件夹blob
cd blob
npm install
hexo generate //可简写为hexo g
hexo sever //可简写为hexo s

启动服务
访问 http://localhost:4000 会出现hello world

3.2 上传GitHub

3.2.1 安装github插件

npm install hexo-deployer-git --save //安装插件

3.2.2 github注册以及配置

(1) 没有GitHub的访问以下网站注册一个账户
	https://github.com
(2) 建立资源库,例如blob
(3) 在hexo中配置该blob地址

3.2.3 本地站点github相关配置

找到hexo安装目录blob文件夹,在站点配置文件_config.yml里修改如下配置:
deploy:
  type: git
  repository: [email protected]:你的Github账户/仓库.git
  branch: master

3.2.3 部署静态文件到github

通过git bash部署到github上
hexo deploy //可简写为 hexo d 

3.2.4 域名关联gitpage

(1) 阿里云域名配置
    在阿里云域名模块解析域名配置
    	将记录类型设置为CNAME;
    	记录值修改为 yourname.github.io
    在hexo安装目录中找到source文件夹
    	新建CNAME文件,没有后缀。
    	将你的域名放在新建的CNAME文件中。
(2) GitHub Pages配置
    在blob资源仓库中Setting里,  下拉找到GitHub Pages部分
	配置 Custom domain,将你的域名填写进去,点击save。

github pages

4. 其他

Git Bash

//清除缓存
hexo clean 
//生成静态网页
hexo g
//部署到git
hexo d
//本地服务启动
hexo s

猜你喜欢

转载自blog.csdn.net/xingfuzhijianxia/article/details/85342336