Setting Up Ghost on a DigitalOcean Droplet
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:
Check to make sure we have npm we should see this,
Then we’ll follow the typical Ghost install steps:
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.
You should be able, at this point, to check if things are working by pointing to your URL and specifying port 2368, i.e. http://www.example.com:2368. To make things persistent across reboots I’ll defer to the Ghost documentation: http://docs.ghost.org/installation/deploy/ (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.
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 blog.example.com or www.blog.example.com and pass to Ghost, running on port
- The rewrite rules force the dashboard (http://www.blog.example.com/ghost) 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 “blog.example.com” 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: http://blog.apericore.com/securing-your-ghost-blog/
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!