Setting Up Ghost on a DigitalOcean Droplet

3 minute read

You’re currently viewing an installation of Ghost on a DigitalOcean droplet. I set this up almost a month ago, so let’s go through my old notes and see how I did it, shall we?

(Only after writing this do I really have an appreciation for writing these guides while doing the steps, this post is made from month old, poorly kept, notes, and for that I apologize in advance, I hope you find it helpful regardless.)

Instrumental to the process, but not the only resource I used, was the ghost documentation.

I already had a website running on apache2 on the droplet, so I’m going to assume that as a starting point. I’m also running Ubuntu 12.04 on the droplet.

To start, I was missing some requirements, namely node, so I had to install that:

$ apt-get install python-software-properties python g++ make
$ add-apt-repository ppa:chris-lea/node.js
$ apt-get update
$ apt-get install nodejs

Check to make sure we have npm we should see this,

$ npm

Usage: npm <command>

where <command> is one of:
    add-user, adduser, apihelp, author, bin, bugs, c, cache,
    completion, config, ddp, dedupe, deprecate, docs, edit,
    explore, faq, find, find-dupes, get, help, help-search,
    home, i, info, init, install, isntall, issues, la, link,
    list, ll, ln, login, ls, outdated, owner, pack, prefix,
    prune, publish, r, rb, rebuild, remove, repo, restart, rm,
    root, run-script, s, se, search, set, show, shrinkwrap,
    star, stars, start, stop, submodule, tag, test, tst, un,
    uninstall, unlink, unpublish, unstar, up, update, v,
    version, view, whoami

npm <cmd> -h     quick help on <cmd>
npm -l           display full usage info
npm faq          commonly asked questions
npm help <term>  search for help on <term>
npm help npm     involved overview

Specify configs in the ini-formatted file:
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@1.4.3 /usr/lib/node_modules/npm

Then we’ll follow the typical Ghost install steps:

$ sudo mkdir -p /var/www/
$ cd /var/www/
$ curl -L -O
$ sudo unzip -d ghost [Name-of-Ghost-zip].zip
$ cd ghost/
$ sudo npm install --production
$ cp config.example.js config.js
$ sudo vim config.js

Under production in config.js we’re going to want to change the url and host to our url and IP address. The default port is 2368, which I’m going to leave, as we’ll have apache forward 80 to this port anyway.

To run ghost in a production environment we’ll make a ghost user and run ghost with this user.

$ sudo adduser --shell /bin/bash --gecos 'Ghost application' ghost
$ sudo chown -R ghost:ghost /var/www/ghost/
$ su - ghost
$ cd /var/www/ghost/
$ npm start --production

You should be able, at this point, to check if things are working by pointing to your URL and specifying port 2368, i.e. To make things persistent across reboots I’ll defer to the Ghost documentation: (I’m using the init.d method here.)

At this point things should be working across reboots if you point to the used port. Finally we will configure apache to pass to port 2368 when we visit port 80 (the default port). At the same time we’ll look at securing the dashboard page with our own ssl certificate. Let’s look at a config file and talk through the options.

<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass / http://123.456.7.890:2368/

    # Rewrite rules
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?ghost/(.*) https://%{SERVER_NAME}/ghost/$1 [R,L]

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        ProxyRequests Off
        ProxyPass / http://123.456.7.890:2368/
        ProxyPassReverse / http://123.456.7.890:2368/
        ProxyPreserveHost On
        &lt;Proxy *&gt;
            Order deny,allow
            Allow from
        # SSL Configuration
        SSLEngine on
        SSLCertificateFile /etc/apache2/ssl/apache.crt
        SSLCertificateKeyFile /etc/apache2/ssl/apache.key

You may need to enable some or all of the following modules: proxy, proxy_http, ssl, and rewrite. You may do so by issuing $ sudo a2enmod module, and then restarting apache with $ sudo service apache2 restart.

At the top is the http configuration, which will allow you to visit or and pass to Ghost, running on port

  1. The rewrite rules force the dashboard ( to use HTTPS. The bottom configures the https connection.

We also need to add to our DNS records, an A record, with “blog” and our IP address as the name and hostname, and a CNAME record with “*.blog” and “” as the name and hostname.

I must acknowledge that a lot of helpful info in the apache configuration, especially when setting up the SSL part of things was found here:

I’m hoping this helps out those setting up Ghost on apache, as most of the guides I saw were written with nginx in mind. I’m still sort of new to setting up my own webservers, and was already familiar with apache, but nginx seems to be quite appealing, so perhaps I’ll be making that switch soon!