安裝node.js
(參考這里)
yum源沒有包含nodejs,需要先安裝EPEL
- 安裝EPEL 源
yum install epel-release
- 安裝nodejs
yum install -y nodejs
- 通過在終端窗口中輸入
node -v
和npm -v
檢查 Node 和 npm 是否安裝成功
安裝ghost
-
下載ghost
wget -c http://dl.ghostchina.com/Ghost-0.5.9-zh-full.zip
- 解壓
(需要先安裝有unzip軟件,yum install unzip
)
unzip -uo ghost.zip -d ghost
- 安裝ghost
cd ghost
npm install --production
- 啟動ghost
npm start
Ghost 將會運行在 127.0.0.1:2368
你可以在config.js
中修改IP地址和端口
安裝forever
(參考這里)
npm start
命令在終端關閉后就自動結束了。需要ghost一直運行下去,要用到forever
- 安裝
npm install forever -g
- 讓forever從 Ghost 安裝目錄運行
NODE_ENV=production forever start index.js
- 啟動、重啟、停止forever
forever start index.js forever restart index.js forever stop index.js
- 查看forever列表
forever list
安裝配置nginx
Centos6.5mini軟件源默認沒有nginx,需要先安裝EPEL。
- 安裝
yum install nginx
- 配置
vi /etc/nginx/conf.d/default.conf
修改location為:location / { root /usr/share/nginx/html; index index.html index.htm; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_pass http://127.0.0.1:2368; }
- 重啟nginx
service nginx restart