Wednesday, 1 October 2014

さくらのVPSにブログCMS、Ghostを設置

Ghostのインストール方法(公式)
http://docs.ghost.org/ja/installation/mac/

今回は、サーバーに/blog/というディレクトリを作ってそこにインストールした。

Ghostのconfig.jsは、

url: 'http://”blog.ドメイン.com' 
server: {
     host: '127.0.0.1',
     port: '2368'
}


次に、blog.ドメイン.comにアクセスが来たときに、http://127.0.0.1:2368/ へ転送する設定

sshでVPSにログイン

$ sudo vi /etc/httpd/conf/httpd.conf 
で、httpd.confを開いて、

<VirtualHost *:80>
    ServerName blog.ドメイン.com
    ProxyPass / http://127.0.0.1:2368/
    ProxyPassReverse / http://127.0.0.1:2368/

</VirtualHost>

を追加。

apacheを再起動。
$ sudo /etc/init.d/httpd restart

Ghostをインストールしているディレクトリに行って、
npm start --production
で起動確認。

これだと、Terminalを落とした段階でサーバーもストップするので、

または、
npm install forever -g
でforeverをインストール。

NODE_ENV=production forever start index.js

で起動。


終了するときは、
forever stop index.js




No comments:

Post a Comment