/ tools

How to run multiple Ghost blogs on single DigitalOcean droplet.

I spent some time looking for an efficient way to create multiple blogs for all the side projects I manage and finally found a bearable solution that allows me to set up a new blog pretty fast. In this post, I'll take you through the process of creating a new blog. Hopefully, it will save you bunch of time in future.

Ghost offers a robust solution of hosting 3 blogs for a monthly payment of 39$, but it seems too much for my needs as most of my project doesn't have enough traffic and still are at the stage of idea validation.

Here are some criterias of what I was looking for.

  • Cheap
  • The quick and painless setup process for every new blog.
  • Lightweight and flexible.
  • Markdown editing.

Armed up with those criterias I went out to hunt for a solution. My booty was several Ghost instances running on DigitalOcean droplet for 10$ a month.

Ghost is a lightweight blog engine written on Javascript stack (nodejs, handlebars) and I feel much more comfortable to work with it then with Wordpress that became way too complicated trying to serve everybody's needs.

DigitalOcean is host provider that gives you a Linux machine for 10$ and you are allowed to do anything you want with it. I also already have a DigitalOcean account with running RoR application, so it was a painless choice.

The rest of the post I'll explain how to setup Droplet for multiple hostings. I assume that you know how to use Linux command line, and understand the basics of Networking. Let's get our hands dirty!

Note

I assume that you have already bought a domain (or two) using the domain register of your choice. Later on this tutorial we will have to login into our domain management dashboard in order to create a new A record. There shouldn't be much difference in how to do this between services.

Ok let's start...

Step 1. First - go ahead and create DigitalOcean account.

Follow this link you'll get one month free (10$ credit).
this

Step 2. Hit the 'Create' button on the top and create a new droplet.

You will see a new droplet creation dialog.
create_new_droplet
Click one-click apps and find "Ghost on 16.04". complete the rest of the steps according to your preferences.
choose_one_click_install
rename_droplet_name

Step 3. Add a domain and point it to your new droplet.

Open a context menu on the right next to your droplet name. Select "add domain" option.
add_domain_to_droplet

Now you can add your domain simply by typing yourdomain.com or you can type something like blog.yourdomain.com the last especially helpful when you want to separate the hostings of your landing page and the blog.
add_domain_name_to_droplet

I host all my landing pages on firebase for free, and I only want to host my blog here.
new_domain_added_to_droplet

Step 4. Edit an A Record of your domain provider dashboard.

You can see an IP address next to your domain name in a DigitalOcean domain. You have to edit an A Record from your domain provider dashboard so it will point to this IP address.
edit_zone_record
fresh_new_a_records

Step 5. Connect to your Droplet via SSH.

After you've created your domain, you should get an email from the service with credentials of your new droplet. Open a terminal and SSH to your remote machine using ssh root@<your-droplet-ip>
Next, you will be asked for a password, use the temporary password that you've got by email. It will ask you to change your password, make sure you write down your new password somewhere.
ssh_to_droplet

Step 6. Setup a database for your new blog.

We need to create a new database for each blog. first type /root/.digitalocean_password - You should see MySQL passwords for both root and ghost users. We will need those passwords lately.

root user used to create MySQL databases and provide privileges to other users.
Let's log in to MySQL and create a new database.

  1. MySQL -u root -p
  2. Enter password:
  3. show databases; - see all databases you currently have.
  4. mysql> CREATE DATABASE your_domain_name_production; - create a new database.
    Query OK, 1 row affected (0.00 sec) - if everything ok you'll see this message.
  5. GRANT ALL PRIVILEGES ONyour_domain_name_production.* TO 'ghost'@'localhost'
  6. GRANT USAGE ON *.* TO 'ghost'@'localhost'; - no rows should be affected by those two lines

Step 7. Create a dir for your new blog.

By default, a droplet installs a single instance of your blog in /var/www directory. You can navigate there with cd /var/www/.
Type ls to see what in this dir, you will see ghost.
We want to create a separate folder for each blog.
To do so follow these steps:

  1. mkdir yourblog.com - create a new dir.
  2. yourblog.com - step into the new dir.
  3. ghost install - install a fresh instance of Ghost.
    ✔ Checking system Node.js version
    ✔ Checking current folder permissions
    ✔ Checking operating system
    ✔ Checking MySQL is installed
    ✔ Checking for latest Ghost version
    ✔ Setting up install directory
    ✔ Downloading and installing Ghost v1.18.0
    ✔ Finishing install process
    

It will ask you several setup questions:

? Enter your blog URL: https://talkingbots.net
? Enter your MySQL hostname: localhost
? Enter your MySQL username: ghost - use ghost user
? Enter your MySQL password: [hidden] - enter your password for ghost user
? Enter your Ghost database name: production_talkingbots - use database name from the previous step.
Do you wish to set up Nginx? - type y
Do you wish to set up SSL? - type y
? Do you wish to set up "ghost" MySQL user? - type n because the user exists already
Do you wish to set up Systemd? - type n
Do you want to start Ghost? - type no

That's it! Now you should see your blog on https://yourdomain.com if not - try ghost start or ghost stop & ghost start

Navigate to https://yourdomain.com/ghost to do an initial setup and create a user.

Conclusion

After walking through those steps once it will take 15 minutes for you to set up a blog for your new project.
Those days I'm working on several projects and learning a bunch of new things in a field of idea validation and marketing. If you are interested in marketing and idea validation for micropreneurs, then follow me on Twitter @libinpage.
Want to make sure that you never miss any piece of content signup for this mail list and get new posts to your email.