Running Ghost 2 on Plesk Onyx

A Better Way

I updated the end of this article a while back, but RunCloud has recently made it easy to self-host Ghost.

This blog runs ran on the Ghost blogging platform (see below for updates). I generally use WordPress, but I wanted to give this a try, as I’ve seen many other blogs effectively use this software. Not wanting to shell out $30 per month, I started self-hosting it on its own VPS at Vultr. That got me down to $5 per month. But I already have a solid VPS where I host many other domains, but it didn’t support NodeJS.

Thus began my migration to Plesk. After several years using ServerPilot‘s free plan, I wanted something more self-hosted. At Vultr, I can spin up a Plesk instance for the price of the VPS, plus $7.50 per month for up to 30 domains. After migrating almost all my other sites to the new server, I began researching installing Ghost on Plesk. There just isn’t that much documentation on how to do this. Fortunately, I stumbled upon a YouTube Video for installing an older version of Ghost. After much experimentation, it turned out to be a pretty straightforward process:

  • Enable Node and Phusion Passenger through Plesk’s Updates and Upgrades
  • Make sure Apache Web Server Settings has “passenger” enabled
  • As root, install the runtime binaries: curl -sL https://deb.nodesource.com/setup_8.x| sudo -E bash –
  • Install NodeJS as root: apt install nodejs
  • In Plesk, add your domain and extract Ghost into that directory
  • Create a database for your blog
  • Edit: core/server/config/env/config.production.json for your database settings and add a line for the URL to your domain: “url”: “https://example.com”,
  • With all of your source in place, use Plesk to start NodeJS for your domain:

With all that ready to go, click on NPM Install (to generate Node Modules), then Start (or Restart) App. That should do it! If I missed anything, please let me know.

Upgrading

Running Ghost under Plesk’s Node.js environment means the Ghost CLI update feature doesn’t work. But we already knew getting this working on Plesk requires a bit more effort.

So an upgrade is like a fresh install, but you’ve already done the hard part in the instructions above. So here we go:

  • Make a backup of your site (files & database)
  • Use the Labs export function to save your data
  • Copy the ‘content’ folder to your desktop so you can re-upload it after the upgrade
  • Also save a copy of core/server/config/env/config.production.json to your desktop
  • This may be overkill, but it’s thorough: completely empty out your home directory
  • Using the latest version source, extract Ghost into your home directory
  • Replace the config file with the one you just saved
  • Go to the Ghost admin page and verify the new version is functioning
  • You may have to delete the sample data (also from the Labs section)
  • Use Labs to Import your backup file
  • Re-upload the Content folder
  • That should do it!

As a side note, I also use Cloudflare. For some reason, this stops Scheduled Posts from posting. Ghost’s API post mechanism doesn’t pass through Cloudflare. As a workaround, I added my server’s local IP address to my server’s /etc/hosts file. Now when Ghost triggers a scheduled post, it hits the server directly and bypasses Cloudflare.

I Give Up

At some point, you think about what your time is worth. I’ve decided that it’s worth $5 per month to have a dedicated Ghost server for my two Ghost blogs. Ghost has instructions on how to set up Ghost on Ubuntu. I planned in advance to have two Ghost blogs, so instead of using /var/www/ghost, I create /var/www/SITE1 and /var/www/SITE2 (replacing SITE with unique names). If you run ‘ghost install’ in each directory, it will automatically create a new Ghost instance.

With the dedicated Ghost server, it’s very easy to ‘ghost update’ in each of the directories to keep things up to date. As much as I love to tinker, going through the cumbersome Upgrading process outlined above just isn’t worth my time every month or two. After all, Ghost is updated weekly, so there will always be work to do. Let’s just make it easy on ourselves, ok?

Second Update

I had to edit the very first sentence. After a year of babysitting Ghost, I’ve moved the site to WordPress. Even with a dedicated Ghost server, it still required frequent maintenance. Not only on Ghost itself, but on the dedicated server. WordPress does a good job of taking care of itself, and with this blog on the same server as my other sites, it adds no extra work for me. At this point, I’m having a hard time even remembering what the other Ghost site was. I’ve got my WordPress process so dialed in it’s become set-it-and-forget-it for me. So here is what I use for web hosting: