国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

基于Node.js搭建hexo博客過程詳解

2024-05-06 15:37:27
字體:
供稿:網(wǎng)友

一、安裝新版本的nodejs和npm

安裝n模塊:

npm install -g n

升級(jí)node.js到最新穩(wěn)定版

n stable

二、安裝hexo

note: 參考github,不要去其官網(wǎng)

安裝Hexo

npm install hexo-cli -g

Setup your blog

hexo init blemeshcd blemesh

安裝Cactus主題,眾多開源主題中比較簡潔的一個(gè):

主題頁

Cactus頁

git clone https://github.com/probberechts/hexo-theme-cactus.git themes/cactus

修改主題配置:

vim _config.yml

# Extensions## Plugins: https://hexo.io/plugins/## Themes: https://hexo.io/themes/## theme: landscapetheme: cactustheme_config:colorscheme: white

Create pages and articles with the hexo new [layout] <title> command. For example, to create an "about me" page, run:

hexo new page about

This will create a new file in source/about/index.md Similary, you can create a new article with

hexo new post "hello world"

and add some interesting content in source/_posts/hello-world.md.

Start the server:

hexo server

8001 port:

hexo server -p 8001

三、安裝hexo-admin并配置

安裝:

npm install --save hexo-admin

打開目錄下的_config.yml配置hexo-admin:

admin:

username: XXXX(自己設(shè)置用戶名)password_hash: XXXXXXXXX(密碼,但是是明文經(jīng)過bcrypt hash加密后生成的)secret: hey hexo(用于cookie安全)deployCommand: './admin_script/hexo-generate.sh'(調(diào)用該腳本)

注:

1)其中password_hash是你自己的明文密碼經(jīng)過加密后的字符串,但是如果用類似下面的網(wǎng)址: https://bcrypt-generator.com/ 會(huì)生成:$2y$10$pJjIxxxxxfMn9U/xxxxxNuuA20kh1eoB7vZxxxxx/7WpeV7IOxxxx類似的加密串,但是運(yùn)行會(huì)報(bào)invalid salt revision錯(cuò)誤,其原因是:

➜ blemesh cat node_modules/hexo-admin/www/bundle.js | head -4851 | tail -10if (salt.charAt(0) != '$' || salt.charAt(1) != '2')throw "Invalid salt version";if (salt.charAt(2) == '$')off = 3;else {minor = salt.charAt(2);if (minor != 'a' || salt.charAt(3) != '$')throw "Invalid salt revision";off = 4;}

需要版本號(hào)是2a的加密方式,因此只能用python自己寫了:

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)其中配置中有個(gè)腳本: ./admin_script/hexo-generate.sh 需要自己創(chuàng)建:

➜ blemesh cat admin_script/hexo-generate.sh hexo g➜ blemesh chmod +x admin_script/hexo-generate.sh             
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 鲜城| 平舆县| 兴和县| 彝良县| 姜堰市| 尤溪县| 元谋县| 聊城市| 定襄县| 资阳市| 永年县| 舟山市| 财经| 奈曼旗| 曲周县| 清水县| 怀安县| 吴川市| 和政县| 壤塘县| 宿松县| 饶平县| 新巴尔虎右旗| 北票市| 卫辉市| 拜城县| 辽中县| 泰来县| 应城市| 莱芜市| 綦江县| 望谟县| 灵石县| 临汾市| 贺兰县| 固始县| 响水县| 久治县| 清徐县| 句容市| 丰台区|