Windows本地hexo安装

下载 nodejs: nodejs官网下载

查看 node 的版本:node -v

查看 npm 包管理器的版本:npm -v

配置全局安装的模块路径和缓存路径:在nodejs根目录,创建node_globalnode_cache文件夹

以管理员身份打开cmd(win—输入框—cmd—右键—以管理员身份运行)

npm config set prefix "E:\nodejs\node_global"

npm config set cache "E:\nodejs\node_cache"

配置环境变量,创建 NODE_PATH 变量:值E:\nodejs\node_modules

在系统变量中选择Path添加如下属性:

E:\nodejs\

E:\nodejs\node_global

更改文件夹权限,找到安装nodejs的文件路径下的node_cache,node_global分别更改这两个文件夹的Users权限。右击属性》安全》编辑,把Users的权限设置为全部允许。

npm下载慢的可以下载淘宝下载源cnpm:npm install -g cnpm --registry=https://registry.npm.taobao.org

安装hexo:npm install hexo-cli -g或者cnpm install -g hexo-cli

查看版本:hexo -v

新建空文件夹并进入初始化hexo:hexo init

安装npm: npm install或者 cnpm install

清理:hexo clean

生成:hexo g 或者hexo generate

启动:hexo s

或者同时执行hexo clean & hexo g & hexo s

访问:http://localhost:4000/

hexo-theme-butterfly安装

安装dev分支:git clone -b dev https://gitee.com/immyw/hexo-theme-butterfly.git themes/butterfly

修改 Hexo 根目录下的 _config.yml,把主题改为butterfly:theme: butterfly

如果你没有 pug 以及 stylus 的渲染器,请下载安装:cnpm install hexo-renderer-pug hexo-renderer-stylus --save

在 hexo 的根目录创建一个文件 _config.butterfly.yml,并把主题目录的 _config.yml 内容复制到 _config.butterfly.yml 去

注意: 不要把主题目录的 _config.yml 删掉。以后只需要在 _config.butterfly.yml进行配置就行。如果使用了 _config.butterfly.yml, 配置主题的 _config.yml 将不会有效果。

服务器配置 Nginx

[root@VM-16-9-centos ~]# cd /usr/local/src
[root@VM-16-9-centos src]# wget http://nginx.org/download/nginx-1.9.9.tar.gz
[root@VM-16-9-centos src]# tar -zxvf nginx-1.9.9.tar.gz
[root@VM-16-9-centos src]# cd /usr/local/src/nginx-1.9.9
[root@VM-16-9-centos nginx-1.9.9]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
[root@VM-16-9-centos nginx-1.9.9]# make
[root@VM-16-9-centos nginx-1.9.9]# make install
[root@VM-16-9-centos nginx-1.9.9]# cd /usr/local/nginx/sbin
[root@VM-16-9-centos sbin]# ./nginx

在浏览器输入你购买的服务器的 IP ,可看到下面表示 Nginx 配置成功。

[root@VM-16-9-centos repo]# mkdir -p /var/www/hexo
[root@VM-16-9-centos repo]# chown -R $USER:$USER /var/www/hexo
[root@VM-16-9-centos repo]# chmod -R 755 /var/www/hexo
[root@VM-16-9-centos repo]# cd /usr/local/nginx/sbin
[root@VM-16-9-centos sbin]# ./nginx -s stop
[root@VM-16-9-centos repo]# cd /usr/local/nginx/conf
[root@VM-16-9-centos conf]# vim nginx.conf
#user root;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /var/www/hexo;
# 将 root 解析路径修改为博客目录 /var/www/hexo
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
[root@VM-16-9-centos conf]# cd /usr/local/nginx/sbin
[root@VM-16-9-centos sbin]# ./nginx

把本地电脑上的public里的文件传到/var/www/hexo目录下

hexo-theme-butterfly主题相关配置

Butterfly安裝文檔(一)快速開始

Butterfly 安裝文檔(二) 主題頁面

Butterfly 安裝文檔(三) 主題配置-1

Butterfly 安裝文檔(四) 主題配置-2

Butterfly 安裝文檔(五) 主題問答

Butterfly 主题美化(一)

Butterfly 主题美化(二)

安装部署docsify

更新系统 sudo yum update

安装 Node.js sudo yum install -y nodejs

安装npm sudo yum install -y npm

查看安装版本:node -vnpm -v

安装 Docsify:npm install -g docsify-cli

/var/www/docsify目录下初始化 Docsify 项目: docsify init ./selfstudy

/var/www/docsify目录下本地预览:docsify serve ./selfstudy

配置nginx /usr/local/nginx/conf/nginx.conf

server {
listen 3000;
server_name localhost;
location / {
root /var/www/docsify/selfstudy;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

重启 Nginx 服务器:cd /usr/local/nginx/sbin ./nginx