How to host a Ghost blog on Digital Ocean

Ghost is a beautiful and easy to use blogging platform, it's not as feature-packed as other platforms may be, but it gets blogging right.

Digital Ocean provides a really simple way to get started with Ghost, SSL certificate included.

The first thing you'll need is a Digital Ocean account, you can sign up here. If you register using that link you'll get $100 in credit over 60 days.

Creating a droplet

Droplets are Digital Ocean's virtual machines or computing instances. Our Ghost blog will run on one of these.

After signing up and setting up a payment method (credit card or PayPal), just Go to your dashboard and you will see something like this:

Click on Get Started with a Droplet.

On the next screen, you'll see a few options for our new droplet:

Click on the One-click apps tab.

There's a few apps or stacks ready to use, select Ghost on 18.04.

This will create a new droplet running Ubuntu 18.04 with a Ghost blog ready to use.

After selecting Ghost, scroll down a bit to select the size for the new droplet.

Remember that you can start small and scale up later if you need to.

Scroll further down pass the backups and block storage sections, then you get to choose the region for the new droplet.

Choose the one that suits you.

Further down you can add a new SSH key to the new droplet so you can connect using SSH. It is recommended that you do this and from now on it will be assumed that you added a key.

If you don't add an SSH you'll receive a root password via email.

Finally, you can add more droplets with the same settings and give it (or them) a name.

To create the new droplet just click Create

Setting up Ghost

On your dashboard, you'll now see your new droplet with it's assigned IP address.

If you click on it you'll get more details about your droplet: bandwidth usage, CPU usage, etc.

Copy the IP address and open it in your browser, this is what you will see:

Logging into the droplet using SSH

If you are on MacOS or Linux, open a terminal a type or copy this:

ssh root@your_server_ip

If you are on windows PuTTY is a good SSH client.

After you log in for the first time, you will get the following messages:

It tells you to switch users to manage ghost, so do just that with this command:

sudo -i -u ghost-mgr

Change to the directory where Ghost is installed:

cd /var/www/ghost

Check for updates:

ghost update

To configure Ghost, we start with the setup  command:

ghost setup

Enter the URL for the new site:

# Output
? Enter your blog URL: http://blog.davidpaternina.com

Make sure to include http://. Also, in order to use SSL, make sure that your chosen domain or subdomain already points to the server's IP address.

After this, you'll be asked a few questions about MySql. These settings have already been configured so just continue with the values given:

? Enter your MySQL hostname: localhost
? Enter your MySQL username: ghost
? Enter your MySQL password (skip to keep current password): [hidden]
? Enter your Ghost database name: ghost_production
✔ Configuring Ghost
✔ Setting up instance

Running sudo command: chown -R ghost:ghost /var/www/ghost/content
✔ Setting up "ghost" system user

When the script asks you yo set up a MySql user, enter n, because one has already been set up.

? Do you wish to set up "ghost" mysql user? n

Then, to get our site ready, the script asks you to set up Nginx, enter y.

? Do you wish to set up Nginx? y

With Nginx set up, you are asked if you want to set up SSL with Let's Encrypt.
Remember that this requires you have set a custom domain or subdomain.

To set the certificate enter y or just press ENTER.

? Do you wish to set up SSL? Y
? Enter your email (used for Let's Encrypt notifications) youremail@example.com

If you skip this step you can always set it up later using the ghost setup ssl command.

Next, you will be asked if you want to set Systemd. Enter n, this is already configured.

? Do you wish to set up Systemd? n

Ghost is already running, so when asked if you want start Ghost enter n. Otherwise, you might get an error.

? Do you want to start Ghost? No

You have to restart  Ghost, though, so do that:

sudo systemctl restart ghost\*

Create admin account

In a browser go to http://your_domain/. If you set up SSL you will redirected to https:// automatically.

You will find Ghost is running with it's default theme and some introductory posts:

To create the admin account go to http://your_domain/ghost.

Click Create your account and follow Ghost's setup flow to create your account.

Conclusion

That's it! You have your new Ghost blog up and running.

These are the same steps I followed when setting up the very same blog you are reading.

If you are stuck on any of the steps just leave a comment below.

Until the next one.