安装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
网友评论