Centos7-使用Jekyll在GitPages搭建博客

前言

安裝Git并拉取分支,部署Jekyll

安裝Git

這一步的教程略過(guò) 安裝過(guò)程可以百度 關(guān)鍵詞 git安裝 git教程

拉取代碼

在項(xiàng)目頁(yè),找到原諒色按鈕”clone or download”復(fù)制鏈接,通常為”https://github.com/用戶名/項(xiàng)目名.git”。
調(diào)出命令行:

git clone https://github.com/用戶名/項(xiàng)目名.git

安裝Ruby

yum install ruby

如果出現(xiàn)ruby版本過(guò)低錯(cuò)誤,請(qǐng)參考我另外一篇文章 Centos升級(jí)Ruby

安裝Jekyll

gem install jekyll

配置Jekyll

cd jekyll path // 移動(dòng)到你的jekyll項(xiàng)目下,也就是你從git里clone下來(lái)的項(xiàng)目

jekyll serve // 啟動(dòng)服務(wù),默認(rèn)鏈接地址\"http:localhost:4000\

期間遇到的一個(gè)問(wèn)題:

Configuration file: /Users/czre/git/blog/_config.yml
       Deprecation: The 'gems' configuration option has been renamed to 'plugins'. Please update your config file accordingly.
  Dependency Error: Yikes! It looks like you don't have jekyll-paginate or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- jekyll-paginate' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/! 

這個(gè)原因是因?yàn)闆](méi)有jekyll-paginate,使用gem install jekyll-paginate安裝一下就好了。
另外也有可能出現(xiàn)沒(méi)有jekyll-gist錯(cuò)誤,解決方法同上,這些錯(cuò)誤取決模板所采用的一些服務(wù)。

jekyll server -H 127.0.0.1 --incremental

將此腳本命令設(shè)置為后臺(tái)執(zhí)行,SSH客戶端斷開(kāi)繼續(xù)執(zhí)行

ctrl + z

bg 1

安裝&配置Nginx

安裝nginx略過(guò)

對(duì)nginx.conf進(jìn)行修改,可通過(guò)whereis nginx查看具體的nginx.conf的位置

把nginx.conf添加 一個(gè)虛擬域名解析(根據(jù)不同的端口或者域名來(lái)配置),把監(jiān)聽(tīng)root目錄為clone下來(lái)的文件夾里面_site即可

完成

ngin綁定_site之后,即可通過(guò)域名或者ip+端口的形式進(jìn)行訪問(wèn)了

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容