This post is an overview of what I did and in what order, I've provided links to the tutorials I used in case you need more detailed information.
Here's a list of the things I used to complete my Ghost setup
- Linode 1024 VPS
- Ghost Account
- Mailgun Account
- Installing Ghost on Ubuntu, Nginx and MySQL (Main guide)
- How to secure an Ubuntu 12.04 LTS server - Part 1 The Basics
- Rackspace Cloud Essentials 3 - Basic Cloud Server Security
Setting up the Server
First things first, I needed a server that I could host this blog on. Following a friends recommendation I decided to use Linode, the prices are very reasonable and so far I cannot fault the service they provide. Linode offer several operating systems, I went with Ubuntu 13.04 as this is the Linux distro I am using on a daily basis.
Once I had followed the Linode instructions for setting up a new server and gained SSH access as the root user I carried out the usual update and upgrade using apt-get.
Before even thinking about installing Ghost or any of it's dependencies I needed to get the server secure. This is where the Rackspace, The Fan Club and StricterDefaults posts come in, they are great reference points for what you need to do when securing a new server.
From the Rackspace guide I created a new user, added it to sudoers and configured SSH using to public/private keys. The SSH setup also covered disallowing root access & password authentication, changing the port and restricting allowed users to just my user. The rest of the Rackspace guide about iptables can be ignored as I prefer to use
ufw (Uncomplicated FireWall), which is described in The Fan Club article.
For the purposes of getting Ghost running I decided this was secure enough, I was growing impatient and wanted to try out the flashy new blogging platform. Fully securing my installation will be covered in another post.
The process of installing Node.js was nice and easy, simply add Chris Lea's PPA and install via apt-get (don't forget to update first).
MySQL is a little more complicated than Node.js as you need to give it a root password during installation, then set up the users and databases required by Ghost. Ghost works with two databases, one for production and one for development, on a production server I imagine you don't need the development database, but being my first time using it I setup both anyway.
The instructions from the main guide are all you need here, so I won't elaborate further.
To access this blog Nginx is used as a proxy, this means that in the future if I ever want multiple Node.js programs to serve websites they won't all clash on port 80.
The guide I was following just says install Nginx from the default Ubuntu repository, but I like to have the latest and greatest so am using the Nginx Stable PPA.
After adding the PPA the instructions from the guide worked perfectly for setting up a caching proxy, however, I don't feel this configuration optimal. This is because it sets up the server inside of
/etc/nginx/nginx.conf. I prefer each server to have it's own files in
/etc/nginx/sites-available/. The below gist shows
Something to note is the
location ~ ^/(ghost/signup/) block, this redirect prevents access to the sign up page for your blog, you will need to comment this out to create your own account.
Setting up Ghost
Finally made it to the exciting part, getting Ghost running. The simplest way to get the source code is to download the zip file provided through the website (after login), but if you really want you can download it from GitHub and compile it.
The guide talks you through setting up Ghost with a startup shell script, Forever and a reboot cronjob. After a bit of messing with configurations and rebooting the server I found that this was not too reliable in starting Ghost every time the server boots. My solution is to use upstart instead of Forever, to do this do not use
starter.sh and the crontab from the guide, instead place the following file in
This upstart script runs node as the
www-data user, which is the same as nginx. To use it on your server you may need to update directories and links to your node binary.
All in all the Ghost setup is really simple and lets you get publishing straight away, the live markdown editor is amazing and the interface beautifully clean and simple.
Poking around the tryghost GitHub account I found they actually provide a Vagrantfile that can be used for developing Ghost, brilliant! This will make getting started with learning my way around Ghost a lot quicker.