真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

基于Node.js搭建hexo博客的示例

小編給大家分享一下基于Node.js搭建hexo博客的示例,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

創(chuàng)新互聯(lián)建站專注于企業(yè)成都全網(wǎng)營(yíng)銷推廣、網(wǎng)站重做改版、通榆網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、H5響應(yīng)式網(wǎng)站、商城開發(fā)、集團(tuán)公司官網(wǎng)建設(shè)、成都外貿(mào)網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁(yè)設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為通榆等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。

一、安裝新版本的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 blemesh
cd blemesh

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

主題頁(yè)

Cactus頁(yè)

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: landscape
theme: cactus
theme_config:
colorscheme: white

Create pages and articles with the hexo new [layout] command. For example, to create an "about me" page, run:</p><pre>hexo new page about</pre><p>This will create a new file in source/about/index.md Similary, you can create a new article with</p><pre>hexo new post "hello world"</pre><p>and add some interesting content in source/_posts/hello-world.md.</p><p>Start the server:</p><pre>hexo server</pre><p>8001 port:</p><pre>hexo server -p 8001</pre><p><strong>三、安裝hexo-admin并配置</strong></p><p>安裝:</p><pre>npm install --save hexo-admin</pre><p>打開目錄下的_config.yml配置hexo-admin:</p><p>admin:</p><pre>username: XXXX(自己設(shè)置用戶名) password_hash: XXXXXXXXX(密碼,但是是明文經(jīng)過(guò)bcrypt hash加密后生成的) secret: hey hexo(用于cookie安全) deployCommand: './admin_script/hexo-generate.sh'(調(diào)用該腳本)</pre><p>注:</p><p>1)其中password_hash是你自己的明文密碼經(jīng)過(guò)加密后的字符串,但是如果用類似下面的網(wǎng)址: https://bcrypt-generator.com/ 會(huì)生成:$2y$10$pJjIxxxxxfMn9U/xxxxxNuuA20kh2eoB7vZxxxxx/7WpeV7IOxxxx類似的加密串,但是運(yùn)行會(huì)報(bào)invalid salt revision錯(cuò)誤,其原因是:</p><pre>? blemesh cat node_modules/hexo-admin/www/bundle.js | head -4851 | tail -10 if (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; }</pre><p>需要版本號(hào)是2a的加密方式,因此只能用python自己寫了:</p><p>https://pypi.org/project/bcrypt/3.1.0/</p><pre>>>> hashed = bcrypt.hashpw(password, bcrypt.gensalt(prefix=b"2a")) >>> print(hashed) b'$2a$12$PAoJr3USOBxxxxxxxxxxxxxxV/.h.QNbh/6q.xxxxxxxxxxxxxxxxcDcJ.'</pre><p>2)其中配置中有個(gè)腳本: ./admin_script/hexo-generate.sh 需要自己創(chuàng)建:</p><pre>? blemesh cat admin_script/hexo-generate.sh  hexo g ? blemesh chmod +x admin_script/hexo-generate.sh</pre><p>這個(gè)腳本有什么用,啥時(shí)候觸發(fā)?可以參考: https://www.jianshu.com/p/68e727dda16d step 5,admin后臺(tái)管理博客有個(gè)deploy按鈕,點(diǎn)擊這個(gè)按鈕就會(huì)執(zhí)行這個(gè)腳本,該腳本會(huì)將md文件生成靜態(tài)網(wǎng)頁(yè),如果用nginx配置去訪問(wèn)靜態(tài)網(wǎng)頁(yè),速度會(huì)快很多。</p><p><strong>四、nginx配置</strong></p><p>配置nginx:編輯 /etc/nginx/nginx.conf 插入下面代碼:</p><pre>server { listen 3001; server_name www.beautifulzzzz.com; index index.html index.htm index; root /root/App/blemesh/public;  }</pre><p>之后重啟nginx:nginx -s reload</p><p>注:<br/>執(zhí)行nginx后會(huì)報(bào)錯(cuò)誤:nginx 403 Forbidden,原因是配置文件nginx.conf文件的執(zhí)行用戶和當(dāng)前用戶不一致導(dǎo)致的,把之前的nobody改成當(dāng)前用戶root。</p><p><strong>五、增加tag</strong></p><p>hexo主頁(yè)下的tag標(biāo)簽、category標(biāo)簽無(wú)顯示找不到:</p><p>解決辦法: 在主目錄下執(zhí)行 hexo new page "tags"或者h(yuǎn)exo new page "category"<br/>在/source/tags/index.md中設(shè)置修改</p><pre>? blemesh cat ./source/tags/index.md  --- type: "tags" comments: false date: 2019-02-24 02:53:03 ---</pre><p>同理categories:</p><pre>? blemesh cat ./source/category/index.md  --- type: "category" comments: false date: 2019-02-24 02:53:34 ---</pre><p>或者about me:</p><pre>? blemesh cat ./source/about/index.md  --- title: about type: "about-me" comments: false date: 2019-02-22 00:09:58 ---</pre><p><strong>六、后臺(tái)啟動(dòng)</strong></p><p>hexo server進(jìn)程一直在后臺(tái)運(yùn)行的辦法(執(zhí)行hexo server -d &在一段時(shí)間后會(huì)停止hexo,此時(shí)無(wú)法打開后臺(tái)),采用pm2接管hexo進(jìn)程:</p><pre>npm install -g pm2</pre><p>在博客的根目錄下創(chuàng)建一個(gè)hexo_run.js的文件,文件內(nèi)容如下:</p><pre>? 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}'); })</pre><p>運(yùn)行開啟命令: pm2 start hexo_run.js</p><p>最后附上 zhouwaiqiang 寫的一個(gè)hexo重啟腳本restart_hexo.sh(需要先配置好nginx),需要重啟刷新的時(shí)候執(zhí)行source restart_hexo.sh即可:</p><pre>? blemesh cat restart_hexo.sh  #!/bin/bash PROCESS=`ps -ef|grep hexo|grep -v grep|grep -v PPID|awk '{ print $2 }'` PROC_NAME="pm2" for i in $PROCESS do echo "Kill the $1 process [ $i ]" kill -9 $i done hexo clean #清除數(shù)據(jù) hexo generate #生成靜態(tài)文件public文件夾 ProcNumber=`ps -ef |grep -w $PROC_NAME|grep -v grep|wc -l` if [ $ProcNumber -le 0 ];then pm2 start hexo_run.js else pm2 restart hexo_run.js fi service nginx restart</pre><p><strong>七、體驗(yàn)</strong></p><ul><li><p>啟動(dòng):sh ./restart_hexo.sh</p></li><li><p>訪問(wèn)主頁(yè): http://www.beautifulzzzz.com:8001/</p></li><li><p>訪問(wèn)nginx靜態(tài)快速版網(wǎng)頁(yè): http://www.beautifulzzzz.com:3001/</p></li><li><p>訪問(wèn)后臺(tái)編寫文章: http://www.beautifulzzzz.com:8001/admin/</p></li><li><p>編寫好之后點(diǎn)擊Deploy會(huì)自動(dòng)調(diào)用之前的腳本,靜態(tài)網(wǎng)頁(yè)就有了</p></li></ul><p><img src="/upload/otherpic51/19698.png" alt="基于Node.js搭建hexo博客的示例"></p><p>以上是“基于Node.js搭建hexo博客的示例”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!</p> <br> 新聞標(biāo)題:基于Node.js搭建hexo博客的示例 <br> URL標(biāo)題:<a href="http://weahome.cn/article/gsogcp.html">http://weahome.cn/article/gsogcp.html</a> </div> </div> </div> <div id="squ6kqw" class="other container"> <h3>其他資訊</h3> <ul> <li> <a href="/article/edpdgg.html">淮北抖音代運(yùn)營(yíng)推廣</a> </li><li> <a href="/article/edpdig.html">如何選擇靠譜的抖音店鋪代運(yùn)營(yíng)公司,抖音店鋪代運(yùn)營(yíng)的優(yōu)勢(shì)及例子分析</a> </li><li> <a href="/article/edpdgp.html">抖音賬號(hào)直播運(yùn)營(yíng)需要的平臺(tái),抖音賬號(hào)藍(lán)v怎么運(yùn)營(yíng)的呢?抖音賬號(hào)店鋪審核不</a> </li><li> <a href="/article/edpdgd.html">抖音代運(yùn)營(yíng)怎么選</a> </li><li> <a href="/article/edpdjs.html">短視頻運(yùn)營(yíng)特訓(xùn)班有用嗎</a> </li> </ul> </div> <div id="squ6kqw" class="footer"> <div id="squ6kqw" class="foota container"> <div id="squ6kqw" class="foot_nav fl col-lg-8 col-md-8 col-sm-12 col-xs-12"> <ul> <li id="squ6kqw" class="col-lg-3 col-md-3 col-sm-3 col-xs-6"> <h3>網(wǎng)站制作</h3> <a target="_blank">手機(jī)網(wǎng)站制作</a><a target="_blank">網(wǎng)站制作價(jià)格</a><a target="_blank">手機(jī)網(wǎng)站制作</a><a target="_blank">成都網(wǎng)站制作</a><a target="_blank">手機(jī)網(wǎng)站制作設(shè)計(jì)</a><a target="_blank">成都營(yíng)銷網(wǎng)站制作</a> </li> <li id="squ6kqw" class="col-lg-3 col-md-3 col-sm-3 col-xs-6"> <h3>企業(yè)服務(wù)</h3> <a target="_blank">食品經(jīng)營(yíng)許可證</a><a target="_blank">軟文發(fā)稿</a><a target="_blank">免費(fèi)收錄網(wǎng)站</a><a target="_blank">藥房許可證</a><a target="_blank">互聯(lián)網(wǎng)信息經(jīng)營(yíng)許可證</a><a target="_blank">鏈接買賣</a> </li> <li id="squ6kqw" class="col-lg-3 col-md-3 col-sm-3 col-xs-6"> <h3>網(wǎng)站建設(shè)</h3> <a target="_blank">網(wǎng)站建設(shè)費(fèi)用</a><a target="_blank">企業(yè)網(wǎng)站建設(shè)</a><a target="_blank">金融行業(yè)網(wǎng)站建設(shè)方案</a><a target="_blank">營(yíng)銷型網(wǎng)站建設(shè)</a><a target="_blank">成都網(wǎng)站建設(shè)</a><a target="_blank">企業(yè)網(wǎng)站建設(shè)公司</a> </li> <li id="squ6kqw" class="col-lg-3 col-md-3 col-sm-3 col-xs-6"> <h3>服務(wù)器托管</h3> <a target="_blank">重慶水土雙線托管</a><a target="_blank">重慶電信五里店機(jī)房托管</a><a target="_blank">重慶電信水土機(jī)房托管</a><a target="_blank">德陽(yáng)服務(wù)器托管</a><a target="_blank">重慶電信回興機(jī)房托管</a><a target="_blank">貴安電信機(jī)房</a> </li> </ul> </div> <div id="squ6kqw" class="footar fl col-lg-4 col-md-4 col-sm-12 col-xs-12"> <p>全國(guó)免費(fèi)咨詢:</p> <b>400-028-6601</b> <p>業(yè)務(wù)咨詢:028-86922220 / 13518219792</p> <p>節(jié)假值班:18980820575 / 13518219792</p> <p>聯(lián)系地址:成都市太升南路288號(hào)錦天國(guó)際A幢1002號(hào)</p> </div> </div> <div id="squ6kqw" class="footb"> <div id="squ6kqw" class="copy container"> <div id="squ6kqw" class="fl">Copyright ? 成都創(chuàng)新互聯(lián)科技有限公司重慶分公司 <a target="_blank">渝ICP備2021005571號(hào)</a></div> <!--<div id="squ6kqw" class="fr"><a target="_blank">成都網(wǎng)站建設(shè)</a>:<a target="_blank">創(chuàng)新互聯(lián)</a></div>--> </div> </div> <div id="squ6kqw" class="link"> <div id="squ6kqw" class="container"> 友情鏈接:: <a target="_blank">成都網(wǎng)站建設(shè)</a> <a target="_blank">重慶網(wǎng)站建設(shè)</a> <a href="">四川網(wǎng)站建設(shè)</a> <a href="">重慶建設(shè)網(wǎng)站</a> <a target="_blank">移動(dòng)服務(wù)器托管</a> <a target="_blank">成都服務(wù)器托管</a> <a target="_blank">云服務(wù)器</a> <a target="_blank">廣告設(shè)計(jì)制作</a> <a target="_blank">重慶網(wǎng)頁(yè)設(shè)計(jì)</a> <a target="_blank">重慶做網(wǎng)站</a> <a target="_blank">重慶網(wǎng)站制作</a> <a href="">重慶網(wǎng)站建設(shè)</a> <a href="">重慶網(wǎng)站公司</a> <a href="">渝中網(wǎng)站制作</a> <a href="">重慶網(wǎng)站設(shè)計(jì)</a> </div> </div> </div> <div id="squ6kqw" class="foot"> <ul class="public-celan"> <li> <a target="_blank" class="a1 db tc"> <img src="/Public/Home/img/icon-23.png" alt="" class="db auto"> <span id="squ6kqw" class="span-txt">在線咨詢</span> </a> </li> <li> <a href="tel:18980820575" class="a1 db tc"> <img src="/Public/Home/img/icon-24.png" alt="" class="db auto"> <span id="squ6kqw" class="span-txt">電話咨詢</span> </a> </li> <li> <a target="_blank" href="tencent://message/?uin=1683211881&Site=&Menu=yes" class="a1 db tc"> <img src="/Public/Home/img/icon-25.png" alt="" class="db auto"> <span id="squ6kqw" class="span-txt">QQ咨詢</span> </a> </li> <li> <a target="_blank" href="tencent://message/?uin=532337155&Site=&Menu=yes" class="a1 db tc public-yuyue-up"> <img src="/Public/Home/img/icon-26.png" alt="" class="db auto"> <span id="squ6kqw" class="span-txt">預(yù)約顧問(wèn)</span> </a> </li> </ul> </div> <div id="squ6kqw" class="customer"> <dl class="icon1"> <dt> <a href="tencent://message/?uin=1683211881&Site=&Menu=yes"> <i class="iconT"><img src="/Public/Home/img/QQ.png" alt=""></i> <p>在線咨詢</p> </a> </dt> </dl> <dl class="icon2"> <dt><i><img src="/Public/Home/img/weixin.png" alt=""></i><p>微信咨詢</p></dt> <dd><img src="/Public/Home/img/ewm.png"></dd> </dl> <dl class="icon3"> <dt><i><img src="/Public/Home/img/dianhua.png" alt=""></i><p>電話咨詢</p></dt> <dd> <p>028-86922220(工作日)</p> <p>18980820575(7×24)</p> </dd> </dl> <dl class="icon4"> <dt class="sShow"> <a href="tencent://message/?uin=244261566&Site=&Menu=yes"> <i><img src="/Public/Home/img/dengji.png" alt=""></i><p>提交需求</p> </a> </dt> </dl> <dl class="icon5"> <dt class="gotop"> <a href="#top"> <i><img src="/Public/Home/img/top.png" alt=""></i><p>返回頂部</p> </a> </dt> </dl> </div> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://weahome.cn/" title="真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆">真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆</a> <div class="friend-links"> </div> </div> </footer> <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body><div id="ci6ga" class="pl_css_ganrao" style="display: none;"><tr id="ci6ga"></tr><center id="ci6ga"></center><cite id="ci6ga"></cite><optgroup id="ci6ga"><tr id="ci6ga"><bdo id="ci6ga"></bdo></tr></optgroup><center id="ci6ga"><small id="ci6ga"><blockquote id="ci6ga"></blockquote></small></center><input id="ci6ga"></input><tbody id="ci6ga"></tbody><fieldset id="ci6ga"></fieldset><tbody id="ci6ga"></tbody><strong id="ci6ga"></strong><nav id="ci6ga"><dl id="ci6ga"><xmp id="ci6ga"></xmp></dl></nav><input id="ci6ga"></input><dd id="ci6ga"></dd><em id="ci6ga"><th id="ci6ga"><kbd id="ci6ga"></kbd></th></em><rt id="ci6ga"><option id="ci6ga"><cite id="ci6ga"></cite></option></rt><dd id="ci6ga"><button id="ci6ga"><code id="ci6ga"></code></button></dd><dl id="ci6ga"></dl><optgroup id="ci6ga"><strike id="ci6ga"><li id="ci6ga"></li></strike></optgroup><fieldset id="ci6ga"><delect id="ci6ga"><nav id="ci6ga"></nav></delect></fieldset><wbr id="ci6ga"><sup id="ci6ga"><kbd id="ci6ga"></kbd></sup></wbr><strike id="ci6ga"></strike><dfn id="ci6ga"></dfn><del id="ci6ga"><abbr id="ci6ga"><pre id="ci6ga"></pre></abbr></del><wbr id="ci6ga"></wbr><table id="ci6ga"></table><tfoot id="ci6ga"></tfoot><samp id="ci6ga"></samp><button id="ci6ga"></button><sup id="ci6ga"></sup><td id="ci6ga"></td><code id="ci6ga"></code><ul id="ci6ga"></ul><tr id="ci6ga"></tr><tr id="ci6ga"><li id="ci6ga"><option id="ci6ga"></option></li></tr><strike id="ci6ga"></strike><small id="ci6ga"></small><tr id="ci6ga"></tr><td id="ci6ga"></td><em id="ci6ga"><strike id="ci6ga"><li id="ci6ga"></li></strike></em><abbr id="ci6ga"></abbr><wbr id="ci6ga"></wbr><noframes id="ci6ga"></noframes><pre id="ci6ga"><fieldset id="ci6ga"><del id="ci6ga"></del></fieldset></pre><td id="ci6ga"><acronym id="ci6ga"><cite id="ci6ga"></cite></acronym></td><center id="ci6ga"></center><object id="ci6ga"></object><table id="ci6ga"></table><rt id="ci6ga"></rt><menu id="ci6ga"><acronym id="ci6ga"><cite id="ci6ga"></cite></acronym></menu><bdo id="ci6ga"></bdo></div> </html> <script> $(".con img").each(function(){ var src = $(this).attr("src"); //獲取圖片地址 var str=new RegExp("http"); var result=str.test(src); if(result==false){ var url = "https://www.cdcxhl.com"+src; //絕對(duì)路徑 $(this).attr("src",url); } }); window.onload=function(){ document.oncontextmenu=function(){ return false; } } </script>