ghost是基于node.js的新一代博客平臺——相比日漸臃腫、無所不能的WordPress,Ghost更專注于博客,在官網上打出“只做博客平臺”的口號,因此相對WordPress會更加簡潔易用。
1.基礎配置
1.1安裝node.js及nginx
首先是在VPS上安裝node.js v6 LTS:
curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash -
然后執行
sudo yum -y install nodejs
以及
sudo yum install gcc-c++ make
接下來安裝nginx:
yum install -y nginx
2.安裝ghost-cli
ghost-cli是1.0版本之后出現的新工具。
官網介紹:"With Ghost 1.0.0, we have introduced Ghost CLI - a fully loaded tool to help you get Ghost installed, setup & configured and to make it super easy to keep your Ghost install up to date."
簡單來說就是它能夠幫助我們更加方便地安裝,啟動,升級和管理我們的ghost-blog.
安裝ghost-cli:
sudo npm i -g ghost-cli
不知道是不是因為我的VPS在國內,裝了好久= =..墻越來越厲害了...
早知道應該用cnpm的.
3.ghost安裝
以文件夾blog為例,我們可以先創建一個叫做blog的文件夾安放我們的博客文件:
mkdir blog
cd blog
然后就可以使用ghost-li來安裝ghost了
ghost install [version]
version可為1.0.2等等,如果要安裝最新版只需ghost install
即可.
warning:
此上安裝方法數據庫默認為mysql,如果使用sqlite3可以使用一下語句:
ghost install --db sqlite3 --dbpath ./content/data/ghost.db
接下來會有幾行warning:
System checks failed with message: 'Linux version is not Ubuntu 16'
Some features of ghost-cli may not work without additional configuration
...
我選擇了無視它繼續往前走
后面就會是讓你輸入blogUrl
是否配置nginx SSL Systemd
按照自己意愿做出選擇就好.
4.使用
在nginx.conf做好配置后就能夠重啟nginx了,如果域名解析正確就能夠使用了
進入 http://你的域名/ghost
該網址為ghost的管理后臺