This tutorial is not about porting Hugo posts to the Ghost format but instead, it’s about how I got a custom domain, CDN, and removed the :80 port from a new Ghost CMS install on AWS Lightsail.
First off, setting up the machine on AWS Lightsail is pretty easy. It was as simple as selecting the Ghost install and taking the cheapest instance possible. I think the cost is like $3.50 a month, which is pretty sweet IMHO.
The harder part was then the configuration of everything. When the instance spins up you get a dynamic IP assigned to it. It’s not a pretty custom domain name but rater something like
220.127.116.110, not easy to remember and it does change when you reboot the instance.
I had to set up a static IP (an added yearly cost) to avoid the IP from changing because I was rebooting this instance a lot.
Once I got the static IP, then I had to attach my custom domain
thomasott.io to it. I thought that while I was doing that I should make sure that it’s SSL enabled and that my content would be served through a CDN (Content Delivery Network) for scalability and robustness.
Just those tasks forced me through down a rabbit hole that’s taken me about a day (on and off timewise) to configure my instance. It was fun because I got to tinker with domains, CDNs, and other backend-related stuff, something I normally don’t do.
This tutorial is about how to turn your site into a real Ghost site once you go your AWS Lightsail instance running.
I’m not going to go into detail about setting up the instance, but the four screenshots below show you how easy it is.
First click on ‘Create Instance.’
Then select your Instance location.
Then select Ghost.
You’ll notice there are a lot of other things you can install too. My next goal is to set up a WordPress and Django site as a test and work through the machine configurations like this one.
Finally, you select the size of the instance you want. I went with the cheapest option.
That’s really it, you launch it and it goes live.
Logging in to Ghost CMS
This was an annoying part, I didn’t know where to log into the Ghost admin panel at first. The answer is:
But what are the credentials? The Ghost instance is managed by Bitnami and they have specific instructions on how to log into your Ghost instance. You have to SSH into the instance and run a command to get the password. The default username is
Once you SSH into your instance, get the password, then go to:
Then log in and make a new user. That user will be you and don’t forget your login credentials.
Remove Bitnami header
Once I had a user and tested logging in successfully, I then looked to get rid of that annoying Bitnami header. This was easy to do, I just used the bnhelper tool.
All I did was SSH into the instance and run
This led me to this screen and I selected
Remove the Bitnami Banner.
Set up Static IP on AWS Lightsail
My next step was to attach a static IP to the instance. That was pretty easy too, all I did was navigate to Networking and clicked on
Create static IP.
Then I followed the instructions but selecting where my instance was and filling out the rest of the information.
Set up Custom Domain Zone
Now, this part got tricky, setting up the Custom Domain Zone. Here I wanted to attach my AWS registered domain thomasott.io to this static IP.
In order to do that I needed to make sure that the DNS servers that this instance requires are the same DNS servers set up in my Route 53 Hosted Zone.
There are some important things you need to set up in Route 53 to make sure everything resolves correctly. The problem is that you’ll be setting them up a bit out of order.
The key things for Route 53 are these:
- Make sure the Domain Name Servers are the same in Route 53 and your Lightsail instance of Ghost
- You point an A Name record to the CloudFront Distribution URL (we haven’t set this up yet)
- That your SSL certificate is verified so you can get
https(we haven’t set this up yet either)
The problem is that you won’t have all the information to finish this configuration until you set up your CDN and SSL certificates.
Set up the CDN
It’s advisable to serve your images and content through a CDN (Content Delivery Network). Why? Because it helps with load times and uptime. Ever since I switched to a CDN my SEO for my other blog has skyrocketed. You should consider this too.
To set that up, just click on the
Create distribution button and
Then follow the instructions by selecting your instance (mine is called Ghost-1).
Once you do that, you’ll get a CloudFront URL where your blog will be served too.
Important! Now you’ll have to navigate back to Route 53. In your Hosted Zone for your custom domain, create an ‘A’ Record but select
Alias to Cloudfront distribution.
If you select the correct Instance location, your newly created Cloudfront distribution should populate automatically.
Set SSL Certificates on AWS Lightsail
We’re still not done yet with setting up the custom domain. For that, you’ll need to attach SSL certificates and then reference them back in Route 53.
Click on the Distribution button and navigate down to the
enable custom domain option.
Then navigate lower on the page and click
Create certificate. Fill in your apex domain name (not www.your-custom-domain.com, but custom-domain.com).
Once you create your SSL certificate, it will ask you to verify it. You will need to take that information and create a CNAME record in Route 53. Once you do that, you should be done with all your Custom Domain Name/Zone configurations.
The remaining steps are related to the backend of Ghost and the configuration of the web and production server.
Update Machine Name
SSH into your instance and update your machine name. To do that you’ll need to do the following commands referenced here.
sudo /opt/bitnami/apps/ghost/bnconfig --machine_hostname example.com
where you replace
example.com with your custom domain.
Then to make sure it ‘sticks’ when reboot you’ll have to rename the
bnconfg file like so:
sudo mv /opt/bitnami/apps/ghost/bnconfig /opt/bitnami/apps/ghost/bnconfig.disabled
This next step caused me grief because I couldn’t find the damn httpd-vhost.conf file at first.
I finally found it at
You have to edit this file and update it with your custom domain information. I followed ‘Approach B’ in these instructions.
Then I restarted the webserver.
Update Ghost CMS Production settings
Once I got to this point everything started to work well except I had the port
:80 appended to my custom domain
thomasott.io. it drove me nuts.
It wasn’t until I read this post on how to remove it that I realized there’s this production setting for Ghost.
Once I removed the :80 from the JSON file and restarted the instance, everything worked.
I’m probably forgetting something because these were small tweaks that were numerous but not hard. I will update this post with any missing information when I remember it.
Hey! Get on Our Newsletter!
Learning Python Programming the Easy Way
I picked up python programming when I needed to do something but couldn’t figure out how to connect the dots. Luckily there were some great books out there that I picked up and helped accelerate my learning process. Affiliate links are below:
Leave a Reply