How to actually build a Ghost Blog on Ubuntu 14.04
I’ve tried a few different ways to make this blog, and not all of them successful. I really have beginner level experience with Linux, Node.js and nginx so I probably made some stupid mistakes. I succumbed to the AWS marketplace to get my first instance up and running because it was zero configuration (click and giggle).
However, since Atlantic.net announced $1/month VPS’ I decided to get my blog off of AWS and onto something that’ll run for much cheaper. It is just a blog after all.
Now I’ve personally found a lot of the guides online are really good, but they never seem to work when you follow them verbatim. There’s always one little bit that just doesn’t work, and so you’re left 99% of the way there scratching your head.
So I’m putting what I did here. This is everything I did to get my blog alive and on the web.
# Provision Atlantic Ubuntu Server 14.04 Machine
# Get Username and Password from Email sent from Atlantic
# Log into server via SSH using the Public IP provided
Install server updates:
1 | sudo apt-get update |
Install Node.js:
1 | sudo aptitude install -y build-essential zip vim wget |
Install Ghost:
1 | sudo mkdir -p /var/www/ |
Create an account to run the Ghost Blog:
1 | sudo adduser --shell /bin/bash --gecos 'Ghost application' ghost |
Install an nginx proxy:
1 | su - root |
Install pm2 to allow the ghost instance to run without an open console to the server:
1 | sudo npm install pm2 -g --unsafe-perm |
Install a self-signed certificate and configure nginx to enable HTTPS:
1 | su - root |
Everything should work now! Try browsing to http://site-public-ip and https://site-public-ip to see if it works.
You can now point your domain name to the blog, and also employ some security hardening to keep the bad guys out. At least make sure you change the root password first, as you’ve got a copy of it sitting in your email from the provisioning.
I also turned on forcing SSL for the logon page, but I foolishly didn’t write down how I did it. I’ll try to add that to this list for the future. Don’t even think about logging into your blog over plain http, as that will expose your username & password to anybody who may be listening on the connection at the time.