Hosting your own Ghost blog — Part 1 | by Sang Song | FAUN Publication

This post was originally published in https://ssong.uk to stay updated on my posts follow me on twitter .

Ghost is an extremely powerful blogging platform that gives the user full control over their blog and their content. Consequently, using a Ghost hosted blog can be very expensive with pricing starting at $30 per month. This tutorial will show how anyone can host their own Ghost blog for (almost) free for one year using the Google Cloud Platform (GCP) .

Setting up the VM

While Google Cloud Platform has readily deployable Ghost instances it does not offer the same kind of versatility a Virtual Machine can offer. Setting up your own Virtual Machine on Google Cloud Platform takes only a few clicks.

Before proceeding any further, make sure that you are taking advantage of the free trial offer by Google. This gives you $300 (or the local currency equivalent) that can be used over a period of a year. This is crucial as it would cover the hosting costs for the VM, allowing us to host our own Ghost blog for free.

Creating a Compute Engine VM Instance

Once you are set up with the free trial you should find yourself in the Google Cloud Console. From the menu, select Compute Engine and VM Instances.

From here click on Create Instance and create a new VM with the following settings:

  • Name: Set it to anything you’d like
  • Region: Based on the region setting the costs may fluctuate
  • Machine Type: Small would be more than sufficient for this
  • Boot disk: Change it to Ubuntu 18.04 LTS
  • Firewall: Enable both HTTP and HTTPS traffic

Setting a Static IP Address

Once you have the VM running, we need to set up a static IP Address for it so the domain name servers know where users are meant to be redirected to. Right now if you type in your domain name on your webbrowser of choice it will most likely return an error or redirect you to an arbitrary page set up by your domain name provider. We want to change this so it redirects to your server, and by extension, your blog.

To do this on the GCP You have to go to the External IP addresses setting under VPC Network in the main menu. Here you will see your VM instance and right now under Type it should say ‘Ephemeral’, we want to change this to ‘Static’, it should only take a few moments to complete and once it is done you will have your own static IP address for your server!

*The difference between Ephemeral and Static IP addresses*

The difference between the two could be explained through a simple housing example. An Ephemeral IP address is like short-term renting, while you live at the property (IP address) that is where people should go to find you, but it is not a permanent address, every time your server restarts you get a new address. A static IP address, on the other hand, is like owning your own property, unless you manually choose to remove the static address it will be allocated to your server even if it restarts.

Setting up the DNS

Allocating your server a static IP address alone is not enough to have your website be accessible by everyone. We need update the DNS settings so it knows that yourdomain.com should point to your.static.ip.address. The instructions for this will marginally vary based on which domain registrar you are using but most of them will offfer a settings page for DNS settings.

Here you want to add two records: one A record; and one CNAME record. If you already have an A record then feel free to modify the existing ones.

  • Record Type: A
  • Host: your_domain.com (without the www)
  • Points to: The static IP address we created above
  • TTL: automatic

Then add a CNAME record, again if you have an existing record feel free to modify that.

  • Record Type: CNAME
  • Host: www
  • Points to: your_domain.com
  • TTL: automatic

*What do A and CNAME records mean?*

Within your DNS settings, you can see that there are many different record types. So what do all of them mean? You can find a good explanation for the top seven records here.

Now that we are all set up, we can install Ghost!

Join our community Slack and read our weekly Faun topics ⬇

If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇