Ubuntu下安装Ghost博客系统

安装Nodejs Link to heading

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

检查是否安装成功

root@hkvps:~# node -v
v0.10.37
root@hkvps:~# npm -v
1.4.28

安装Ghost Link to heading

Ghost下载地址https://ghost.org/download/

wget https://ghost.org/zip/ghost-0.6.4.zip
unzip ghost-0.6.4.zip -d ghost
cd ghost
npm install --production

运行Ghost

npm start

可以通过127.0.0.1:2368来访问

通过nmp start来运行Ghost,退出后就会停止,因此需要一个方法让Ghost一直运行

让Ghost一直运行 Link to heading

安装forever

npm install forever -g

进入ghost目录,执行以下命令,让Ghost一直运行

NODE_ENV=production forever start index.js

停止ghost

forever stop index.js

查看forever运行列表

forever list

结合Nginx配置域名 Link to heading

安装Nginx

sudo apt-get install nginx

编辑配置文件

sudo vi /etc/nginx/sites-available/ghost.conf

写入如下内容

server {
    listen 80;
    server_name aquan.me;

    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:2368;
    }
}

重启Nginx

sudo ln -s /etc/nginx/sites-available/ghost.conf /etc/nginx/sites-enabled/ghost.conf
sudo service nginx restart

参考:

http://docs.ghostchina.com/zh/ http://972169909-qq-com.iteye.com/blog/1739928