As part of your web development career you have probably spent countless hours fiddling with server installations and configurations. I know I have. Not really your job, not quite your expertise, but someone's gotta do it right? If you have never used them before, DigitalOcean's droplets will seem like pure magic. A real game changer.

In this post I will walk you through setting up your self-hosted Ghost website utilising the official Ghost droplet.

What is a droplet?

DigitalOcean's droplets are lightweight Linux-based virtual machines (VMs) in the digital ocean running on DigitalOcean's cloud platform. You can configure as many as you'd like with the specifications of your choice, install Ubuntu, Debian or whichever Linux distribution you prefer and set them up to your liking. Nothing new here. What sets DigitalOcean apart is that they have a huge marketplace with free pre-configured and officially maintained droplets. Manual included.

Why go through all the hassle of setting up a production server yourself when you can just grab something off the shelf which is already optimally configured out-of-the-box? Exactly.

Getting started

Sign up with DigitalOcean1 if you haven't already. Once you are logged in, visit the page for the the official Ghost droplet. Click Create Ghost Droplet.

DigitalOcean will ask you how you would like your new droplet configured. There are several plans available, you get to pick your datacenter location and a few other options.

If you are just getting started with your website, you will be fine picking the Basic $5/month plan. You can always upgrade later.

The Basic $5/month plan will suit you just fine. You can always upgrade later.

Next, select the datacenter closest to you or closest to your intended target audience. For example, if you are located in India you could pick the datacenter in Bangalore, but if your target audience is primarily from the United States you might be better off picking the datacenter in New York or San Francisco. Don't overthink it.

Pick the datacenter closest to you or closest to your intended target audience.

Next, pick your root password (or set up authentication with SSH keys if you prefer), pick a good hostname and decide whether you would like to pay extra for weekly backups or not.

There are a few more options you could check, but to be perfectly honest I haven't quite figured out what they do... so I have just left them all unchecked, except monitoring.

Click Create Droplet if you are ready to proceed. DigitalOcean will now create the pre-configured droplet for you and show you its IP address once finished.

Point your domain name to your droplet

With your droplet setup correctly, it is time to point your registered domain name to the droplet's IP address. Setting this up will vary from registrar to registrar (GoDaddy, NameCheap, etc.). This is how it looks like in NameCheap's Advanced DNS screen for the selected domain name:

Namecheap's Advanced DNS

Here, you'll need to point the A record for @ to the IP address of your droplet. Save your changes.

Make sure your DNS changes have propagated before you proceed to the next step. This could take an hour, in rare cases even a day. The easiest way to check is just to open a terminal and ping your domain name:

ping yourdomainname.com

If the changes have propagated your should now see the IP address associated with your droplet. If you see a different IP address check again in an hour or so.

Post-deployment: installing Ghost

We are getting there! With your droplet deployed and your domain name correctly set up, it is time to complete the installation of Ghost. Open your terminal and login to your droplet:

ssh root@your_droplet_ip_address

You will be prompted for the root password you set earlier. Once logged in, the Ghost installation will start automatically. Press Enter when you are ready to proceed.

When prompted, make sure you enter your full url, i.e. https://yourdomainname.com

You will be prompted during the installation process to enter your blog URL. I wasn't sure at first whether I should enter my domain name (yourdomainname.com) or the actual url I intended to use (https://yourdomainname.com). Turns out you'll need to input the latter. When you do and you've entered https (you should!) instead of http, Ghost will even arrange a free Let's Encrypt SSL certificate and set it up for you. Nice touch!

Congratulations, your shiny new website has been successfully installed. Well... almost.

Setup the admin user

As soon as you're done, visit the administrative interface of your new website at https://yourdomainname.com/ghost and create your admin user. Don't wait too long: if anyone were to accidentally stumble upon your website in the mean time they could configure the administrative user, lock you out & take over and potentially even take control of your DigitalOcean droplet.

Secure MySQL

You are now probably itching to get started, but there's just one more step to take care of and that is securing the MySQL installation. An easy step to forget, but don't. This is important.

In the terminal, just enter:

mysql_secure_installation

You will be asked to set a password for the MySQL root user and offered some sensible configuration changes for use in a production environment.

Secure your MySQL installation by setting the root user's password, limit access and accept some sensible configuration changes for use in a live environment.

Congratulations, that's it! You're done! Time to explore Ghost on your own and start your blogging journey. Do keep in mind however that this is now your server and your responsibility: make sure to keep it up to date.

1: This is my referral link. Everyone I refer gets $100 in credit over 60 days. And if you decide you like DigitalOcean, once you've spent $25 with them, I will also get a one-time $25.