在CentOS上搭建基于Nodejs的Ghost博客

Ghost介紹

Ghost 是基于 Node.js 構(gòu)建的開源博客平臺。Ghost 具有易用的書寫界面和體驗,博客內(nèi)容默認(rèn)采用Markdown 語法
書寫。Ghost 的目標(biāo)是取代臃腫的 Wordpress。

搭建Ghost博客系統(tǒng)

1、本機(jī)測試環(huán)境

創(chuàng)新互聯(lián)公司主要從事網(wǎng)站設(shè)計制作、成都網(wǎng)站制作、網(wǎng)頁設(shè)計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)尼開遠(yuǎn),10余年網(wǎng)站建設(shè)經(jīng)驗,價格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18980820575

[root@mingc ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@mingc ~]# uname -r
3.10.0-514.26.2.el7.x86_64

2、 安裝Node.js

#更新yum源
[root@mingc ~]# yum update -y
#安裝軟件組包Development Tools
[root@mingc ~]# yum groupinstall -y "Development Tools"
#安裝NodeSource Node.js 6.x repo
[root@mingc ~]# curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
#yum安裝 nodejs
[root@mingc ~]# yum -y install nodejs
#npm國內(nèi)鏡像(npm是隨同NodeJS一起安裝的包管理工具)
[root@mingc ~]# npm config set registry https://registry.npm.taobao.org
#安裝cnpm模塊(因為國內(nèi)網(wǎng)絡(luò)的關(guān)系,也同時安裝了 cnpm 模塊,后續(xù)將使用該命令代替 npm 命令。)
[root@mingc ~]# npm i -g cnpm

#通過node -v 和npm -v命令查看是否安裝成功。
在CentOS上搭建基于Nodejs的Ghost博客
3.、安裝 ghost
①安裝 Ghost Client (ghost-cli)

[root@mingc ~]# cnpm i -g ghost-cli
#安裝成功后通過運行 ghost -v,出現(xiàn)版本號即可表示安裝成功。
[root@mingc ~]# ghost -v
Ghost-CLI version: 1.7.1

②添加 Ghost 運行用戶并創(chuàng)建目錄

[root@mingc ~]#  adduser ghost
[root@mingc ~]#  mkdir /var/www
[root@mingc ~]#  mkdir /var/www/ghost
[root@mingc ~]#  chown ghost /var/www/ghost

③安裝SQLite3 數(shù)據(jù)庫

#新版本不允許root用戶安裝,需要切換普通用戶進(jìn)行安裝。
[root@mingc ~]# su - ghost 
[ghost@mingc ~]$  cd /var/www/ghost
[ghost@mingc ~]$ ghost install local --db=sqlite3

④啟動 ghost
安裝成功后 Ghost 默認(rèn)就已經(jīng)啟動的

# 停止host
[ghost@mingc ghost]$ ghost stop
# 啟動ghost
[ghost@mingc ghost]$ ghost start
#重啟ghos
[ghost@mingc ghost]$ ghost restart

安裝成功后默認(rèn)是運行在http://localhost:2368/
可使用如下方式訪問:
[ghost@mingc ghost]$ curl http://localhost:2368/

4. 安裝 Nginx和整合nodejs

[ghost@mingc ghost]$ su - root
[root@mingc ~]# yum install -y nginx
#啟動 Nginx
[root@mingc ~]# systemctl start nginx.service
#查看nginx是否運行
[root@mingc ~]# ps -ef|grep nginx
#查看是否啟動成功 http://你的ip

在CentOS上搭建基于Nodejs的Ghost博客

#設(shè)置開機(jī)自啟動
[root@mingc ~]# systemctl enable nginx.service
#整合nodejs
[root@mingc ~]#cp /etc/nginx/nginx.conf  /etc/nginx/nginx.conf.ori
[root@mingc nginx]# vi /etc/nginx/nginx.conf +47
 server {
 ···
        location / {
        proxy_pass http://127.0.0.1:2368;
        proxy_redirect default;
        root   /usr/share/nginx/html;
        index  index.html index.htm;
        }
                ···
[root@mingc nginx]# nginx -s reload             

4. 訪問搭建的ghost博客
前臺頁面:http://你的ip/
在CentOS上搭建基于Nodejs的Ghost博客
后臺登錄頁面:http://你的ip/ghost
在CentOS上搭建基于Nodejs的Ghost博客
后臺管理頁面:
在CentOS上搭建基于Nodejs的Ghost博客

以上搭建過程本人親自操作可用,有問題可留言評論,抽空予以解答,覺得有用點個贊,支持下作者!

分享題目:在CentOS上搭建基于Nodejs的Ghost博客
文章分享:http://bm7419.com/article0/jcegio.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制開發(fā)、外貿(mào)建站、商城網(wǎng)站小程序開發(fā)、面包屑導(dǎo)航做網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

營銷型網(wǎng)站建設(shè)