hexo 博客部署

 下面是主要步骤:

hexo i hexoblog --save #进行安装hexo
cd hexoblog            #进入目录
npm install hexo-admin-ehc --save    #安装后台插件,必须进入目录后安装
cd node_modules/hexo-admin-ehc
npm install    #安装依赖
gulp build     #生成bundle.js  如果存在,这步可以忽略
git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia #安装yilia主题

经过尝试,发现这样组合最好:

主题用yilia

管理后台用:https://github.com/nihgwu/hexo-hey

hexo-hey后台的账号密码在,进入hexoblog根目录,打开配置文件,添加下面

admin:
    username: hexo
    password_hash: hey
    secret: hey hexo
    expire: 60*1
    # cors: http://localhost:3000

======

 

======让hexo后台一直运行========

第一种办法: 

nohup hexo server &

第二种办法:

安装pm2

$ npm  install -g pm2
  • 1

写一个执行脚本

在博客根目录下面创建一个hexo_run.js

//run
const { exec } = require('child_process')
exec('hexo server',(error, stdout, stderr) => {
        if(error){
                console.log('exec error: ${error}')
                return
        }
        console.log('stdout: ${stdout}');
        console.log('stderr: ${stderr}');
})
  •  

运行脚本

在根目录下

# pm2 start hexo_run.js
  • ok! 大功告成!尽情的写你的博客吧!

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值