https://pypi.org/project/bcrypt/3.1.0/
>>> hashed = bcrypt.hashpw(password, bcrypt.gensalt(prefix=b"2a"))
>>> print(hashed)
b'$2a$12$PAoJr3USOBxxxxxxxxxxxxxxV/.h.QNbh/6q.xxxxxxxxxxxxxxxxcDcJ.'2)其中配置中有个脚本: ./admin_script/hexo-generate.sh 需要自己创建:
➜ blemesh cat admin_script/hexo-generate.sh
hexo g
➜ blemesh chmod +x admin_script/hexo-generate.sh 这个脚本有什么用,啥时候触发?可以参考: https://www.jianshu.com/p/68e727dda16d step 5,admin后台管理博客有个deploy按钮,点击这个按钮就会执行这个脚本,该脚本会将md文件生成静态网页,如果用nginx配置去访问静态网页,速度会快很多。
四、nginx配置
配置nginx:编辑 /etc/nginx/nginx.conf 插入下面代码:
server {
listen 3001;
server_name www.beautifulzzzz.com;
index index.html index.htm index;
root /root/App/blemesh/public;
}之后重启nginx:nginx -s reload
注:
执行nginx后会报错误:nginx 403 Forbidden,原因是配置文件nginx.conf文件的执行用户和当前用户不一致导致的,把之前的nobody改成当前用户root。
五、增加tag
hexo主页下的tag标签、category标签无显示找不到:
解决办法: 在主目录下执行 hexo new page “tags”或者hexo new page “category”
在/source/tags/index.md中设置修改
➜ blemesh cat ./source/tags/index.md
---
type: "tags"
comments: false
date: 2019-02-24 02:53:03
---同理categories:
➜ blemesh cat ./source/category/index.md
---
type: "category"
comments: false
date: 2019-02-24 02:53:34
---或者about me:
➜ blemesh cat ./source/about/index.md
---
title: about
type: "about-me"
comments: false
date: 2019-02-22 00:09:58
---六、后台启动
hexo server进程一直在后台运行的办法(执行hexo server -d &在一段时间后会停止hexo,此时无法打开后台),采用pm2接管hexo进程:
npm install -g pm2在博客的根目录下创建一个hexo_run.js的文件,文件内容如下:
➜ blemesh cat hexo_run.js
const { exec } = require('child_process')
exec('hexo server -p 8001 -d',(error, stdout, stderr) => {
if(error){
console.log('exec error: ${error}')
return
}
console.log('stdout: ${stdout}');
console.log('stderr: ${stderr}');









