Ghost blog online

I just installed Ghost blog and what would be a good title of the first blog post? That's right! A post about Ghost =)

Installation

My server is running Ubuntu. Aside from this blog there are a number of websites hosted on it. Its all configured with Apache so I'll write a few notes on installing Ghost blog on Ubuntu and Apache using vhosts (Virtual Hosts).

Apache

I use mod_proxy to pass incoming requests to the Ghost application. I deny any request to /ghost/signup, this is to ensure that none can access the signup page. Right now, but that can change!, there can only be one user.

#/etc/apache2/sites-enabled/000-default

<VirtualHost *:80>  
    ServerName ghost.bjurr.se
    ProxyPreserveHost on
    ProxyPass / http://localhost:2368/

# Enable mod_proxy and uncomment to disable signup
#    <LocationMatch ^/ghost/signup>
#        Order Deny,Allow
#        Deny from All
#    </LocationMatch>
</VirtualHost>  
sudo apachectl restart  

NPM and NodeJS

I initially tried APT to install these packages but since those packages are to old I found another way. I used a script called node-and-npm-in30s.sh.

Installing Ghost

Read about it here.

Making it run, always

There is a number of alternatives here, I went for supervisor.

sudo nano -w /etc/supervisor/conf.d/ghost.conf  
[program:ghost]
command = /home/bjerre/local/bin/node/node /home/bjerre/sites/ghost.bjurr.se/index.js  
directory = /home/bjerre/sites/ghost.bjurr.se  
user = bjerre  
autostart = true  
autorestart = true  
stdout_logfile = /var/log/supervisor/ghost.log  
stderr_logfile = /var/log/supervisor/ghost_err.log  
environment = NODE_ENV="production"  
sudo supervisorctl restart all  

Issues

During setup I had some issues, perhaps my solution can help someone. I installed version 0.3.2.

  • Images folder owned by root. sudo chown ghost:ghost content/images
  • SQLite DB owned by root. sudo chown ghost:ghost content/data/ghost.db
  • Node not found. Fixed by using absolute path to node in supervisor config.
  • config.js not being found. I solved it by downloading current version of config-loader.js from the GitHub repository. wget https://raw.github.com/sebgie/Ghost/6ff17c78a2cb78cf9f445c7c5c41e1350c0840d8/core/config-loader.js

If you have another issue, I would suggest tailing these logs:

  • /var/log/supervisor/*.log
  • /var/log/apache2/error.log