Install Ghost Blog on CentOS

Install nodejs(Required)

tar zxvf node-v0.10.40-linux-x86.tar.gz
ln -s /{node_install_path}/bin/node /usr/local/bin/node
ln -s /{node_install_path}/bin/npm /usr/local/bin/npm
  • check version, node -v & npm -v

Install ghost(Required)

  • download ghost-latest.zip
  • unzip -uo ghost-latest.zip -d ghost
  • execute cmd npm install --production in ghost folder.
  • modify config.js, remove the unused options
var path = require('path'), config;
config = {
    production: {
        url: 'http://www.mydomain.com',
        mail: {},
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost.db')
            },
            debug: false
        },
        server: {
            host: '127.0.0.1',
            port: '2368'
        }
    }
};

module.exports = config;

Run ghost

Nginx & Domain(Optional)

  • install nginx : yum install nginx
  • modify /etc/nginx/conf.d/default.conf, don't forget backup the file :)
server {
    listen       80;
    server_name  www.mydomain.com;

    charset utf-8;
    access_log  /var/log/nginx/log/host.access.log  main;

    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:2368;
        proxy_set_header   REMOTE-HOST $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
  • restart nginx service nginx restart
  • don't forget to setup the domain on DNS provider.

Forever(Recommend)

  • execute cmd npm install forever -g
  • create shell script ghost.sh
NODE_ENV=production forever start index.js
  • create shell script ghost-stop.sh
forever stop index.js

Usage

  • sh ghost.sh for startup
  • sh ghost-stop.sh for shutdown

Enjoy it :)

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容