Making this blog

I'm going to reproduce the steps I took to create this blog, so that I can either do it again in the future, or help someone else do the same. The general steps are:

1. Set up hosting for the Ghost application
2. Set up the domain
3. Configure the server
4. Configure Ghost

Hosting Ghost on AWS (with Bitnami)

Login to AWS Marketplace, search for "Ghost Certified by Bitnami". "Continue to Subscribe" and click through some dialogs start a server instance of Bitnami Ghost. Select a t2.micro instance at the minimum, since t2.nano is too small (I tried and failed to run ghost on one).

Bitnami Ghost on the AWS Marketplace

On the AWS console, generate a keypair and store it somewhere. I stored mine in a folder ~/Development/AWS.

Once the instance is started, find it on the AWS Console under EC2 > Instances. Under the "Description" tab for the instance, copy the Public DNS.

If you copy this into your browser, you should now see the Ghost homepage. In the AWS console, under the "Usage Info" tab for the instance you'll see instructions for how to log into the application:

AWS Marketplace Usage instructions for bitnami Ghost.

Back in AWS, right click on the instance (or click "Actions"), select Instance Settings >  Get System Log. Scroll through the bitnami logs until you find the admin password for signing in to the Ghost application.

Finding the System Logs, to find the Ghost application password.

Use the admin password that you find to sign into Ghost, with the default username user@example.com. Once you're in, add "/ghost" to the end of your URL, and change your admin password to something new.

Last, on your computer, open a terminal, 'cd' into the directory where you stored the keypair, and check that you can ssh to the sever using its public DNS address:

ssh -i keypair.pem bitnami@{PUBLIC DNS}

Since I don't want to keep looking up the public DNS if I don't log in in a while, I create a tiny script to do it:

nano aws-login

Copy in the ssh command from above and save the file. Then make the script executable:

chmod +x aws-login

Now when you want to log in, 'cd' to the directory your key and login script are in, and just do:

./aws-login

Setting up domain stuff

Now the Ghost application is running, but you will want to be able to send people to it at some domain name you choose, like "hyperfinelabs.com".

On the AWS console, create an Elastic IP for the instance. Note the new Public IP and Public DNS.

Register a domain name with some provider (I used Namecheap to register this domain). On the provider's website under DNS settings you'll create/edit two records:

DNS records on Namecheap
  1. An A Record sets what IP address hyperfinelabs.com points to– set this to be the public IP address for your server instance.
  2. A CNAME record sets what www.hyperfinelabs.com points to, and a C-NAME expects to point to another domain. Set this one to the Public DNS for the server instance.

(I wasn't sure why not to do that in reverse, and have the @ host set with the CNAME record and Public DNS, and the www with the A Record and Public IP. I Googled it and this post kind of explains it.)

A half hour or so after setting up the DNS, you should be able to go directly to your site by going to either domain.com (or www.yourdomain.com) in the browser.

Additional server configuration

SSL setup

We also want to be able to use https to connect to the site, so we will need SSL certificates. I struggled to get this working with the bitnami ghost docs, and put this question on the bitnami community forums (which wasn't answered by the time I wrote this):

SSL using bncert-tool on EC2 instance with an Elastic IP
Keywords: Ghost - AWS - Technical issue - Secure Connections (SSL/HTTPS) bnsupport ID: 2eecb7fe-4bff-0633-724d-2be65477eabf Description: I have an AWS ec2 instance running ghost, and I am now trying to enable SSL. This only allows me to post two URLs as a new user, so for the rest of this, {domai…

I ended up following the "alternative approach" described here.

Once you have a valid certificate, you can follow these steps to tell the apache server to forward all http requests to https.

Before you restart the server, you can also disable the bitnami banner:

sudo /opt/bitnami/apps/APPNAME/bnconfig --disable_banner 1

Now restart the server:

sudo /opt/bitnami/ctlscript.sh restart apache

Change the default URL

Currently, Ghost internal links will be prefaced with the IP address still, not the nice domain name you chose. Edit the configuration file:

sudo nano /opt/bitnami/apps/ghost/htdocs/config.production.json

Edit this url parameter to be your domain name (save the file with Control-O):

 url: 'http://yourdomainname.com',

and restart ghost:

cd /opt/bitnami/apps/ghost/htdocs
ghost restart

Note 1: I was not able to get this to work with the url prefaced with "https." So internal links still point to http, and then are redirected by Apache to https. I still currently have problems with Insecure Content warnings, which (I think) are caused by requiring sources with http, from within a page originally over https. I'll look into more it and update this if I fix it.

Note 2: sometimes problems that look like redirection problems are actually browser cache problems. If you keep getting "redirected" when you don't think you should be, try resetting your browser cache.

Configuring Ghost

Now all the external stuff is configured, and the rest can be done in the browser within Ghost. At the bottom of the Ghost General Settings page, you can set the site to be private (require a password) until you're all done setting up.

Browse for a theme you like on the Marketplace, download it, and upload it into Ghost's Settings > Design page. I'm using Attilla. If you want to use Ghost's "members" functionality, you will need a theme that supports members.

For now, I've downloaded a solid background image for the publication cover, and an icon from the noun project for the publication logo and icon.

Done!

Other than some still-unresolved https-related frustrations, this was overall not too difficult. In the future I'll maybe try to figure out how to add comments, and maybe a contact form, though that seems almost silly with Twitter around. I'll make a separate post if I figure out how to do that.

Show Comments