We hope you find this tutorial helpful. In addition to guides like this one, we provide simple cloud infrastructure for developers. Learn more →

How To Use the DigitalOcean Ghost Application for Ubuntu 16.04

UpdatedJune 21, 2017 189.8k views One-Click Install Apps Ghost Nginx Ubuntu Ubuntu 16.04

Introduction

Ghost is a light-weight open-source blogging platform. It's fully customizable and has many themes available.

Using DigitalOcean's one-click Ghost application, you can create a Droplet with Ghost pre-installed and running in just a few minutes.

Step 1 — Creating a Ghost Droplet

To create a Ghost Droplet, start on the Droplet creation page. In the Choose an image section, click the One-click apps tab and select the Ghost 0.11.9 on 16.04 image.

Next, select a size for your Droplet, your desired region, and any additional settings (like private networking IPv6 support, or backups). Add any SSH keys and fill in a hostname for your Droplet. When you're ready, click Create Droplet to spin up the server.

Once your Droplet has been created, visit http://your_server_ip in your favorite browser. You'll see a placeholder page like the one below, which says Please log into your droplet via SSH to configure your Ghost installation.

As the image says, you will need to enable Ghost before you use it by logging in to your Droplet via SSH. This is a security measure that has been put in place to protect Ghost's initial configuration, in which the administrative user is set up.

Step 2 — Enabling Ghost via SSH

Connecting to your Droplet as root via SSH will enable the Ghost installation.

Once your Droplet has been created, you can access it by connecting to your Droplet as root via SSH. This will enable the Ghost installation on your Droplet.

Note: If you haven't used SSH or PuTTY before, you can read How To Connect To Your Droplet with SSH to learn how.

Open a terminal on your computer and log in to your Droplet as root via SSH. Make sure to substitute the IP address of your Droplet.

ssh root@your_server_ip

If you are prompted for a password, enter the password that was emailed to you when the Droplet was created and follow the on-screen prompts to replace your temporary password. If you set up the Droplet with SSH keys, the keys will be used for authentication instead.

Once you log in, you can now safely close out of the session by entering exit. The next step is to configure Ghost via its web UI.

Step 3 — Configuring Ghost

To test that everything's working so far, visit http://your_server_ip in a browser again. This time, you'll see a page that confirms the installation, including a Welcome to Ghost. You're live! message.

To configure your Ghost installation, visit http://your_server_ip/ghost/signup, where you'll see a page that begins with Welcome to Ghost!.

At the bottom of the page is a green button that says Create Your Account, which you should click. Follow the on-screen prompts to create your account, give your blog a name, and invite any team members you may want to include.

Once you have completed these steps, you will be automatically logged in on your new blog. Ghost will provide some instructions on how to get started with your blog from there.

If you want to set up a domain name for your blog, so you can visit it with an address like http://example.com instead of http://203.0.113.0, follow the next step.

Step 4 — Configuring Your Domain Name

First, you'll need to point your registered domain name to your Droplet. At this point, you can access the site through your domain name, but links will direct you back to the IP address. To correct this, you'll need to update two configuration files on your server: one Nginx file and one Ghost file.

On your server, open the Nginx configuration file for editing using nano or your favorite text editor.

  • nano /etc/nginx/sites-available/ghost

You'll see a line that begins with server_name. Replace the IP address with your domain name, so the file looks like this:

/etc/nginx/sites-available/ghost
server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    server_name example.com; # Replace with your domain

    root /usr/share/nginx/html;
    index index.html index.htm;

    client_max_body_size 10G;

    location / {
        proxy_pass http://localhost:2368;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;
    }
}

Save and close the file, then open Ghost's configuration for editing.

  • nano /var/www/ghost/config.js

This config.js file contains configuration for different environments. Your Droplet is automatically configured to run in production mode. Move down the file until you find the production block and look for the url setting. Change this to your domain name so it looks like this once you're done:

/var/www/ghost/config.js
config = {
    // ### Production
    // When running Ghost in the wild, use the production environment.
    // Configure your URL and mail settings here
    production: {
        url: 'http://example.com,
        mail: {},
        database: {
. . .

You now have a fully working Ghost blog. You're ready to start working with Ghost. From here, we recommend you follow our Initial Server Setup guide to give sudo privileges to your user, lock down root login, and take other steps to make your VPS ready for production.

Conclusion

DigitalOcean's Ghost one-click application makes it incredibly easy to get started blogging with Ghost, and your Droplet is set up to make it as easy as possible to look after your blog in the long term.

There are a lot of other options for customization with Ghost. Check out the Ghost usage documentation for more information, or head over to the Ghost Guide. Remember that under certain conditions, like when you install a theme or upgrade, you may need to stop, start, or restart Ghost. You can manage the Ghost service like other Systemd services, using systemctl.

85 Comments

Creative Commons License