deprecated: Install and secure Ghost on Plesk 17.x vServer

deprecated: Install and secure Ghost on Plesk 17.x vServer

UPDATE 3: If your Plesk Server supports docker, have a look at this post: Install Ghost on Plesk Onyx (17.x) vServer with docker

UPDATE 2: Looks like this way it can be done: Using Ghost as an npm module.

UPDATE 1: Since Ghost 1.0 this tutorial does not work anymore. I'll post an updated version of this tutorial as soon as I get Ghost 1.0 running on an Onyx Plesk server.

I did it - or I'm working on it!!!
What you enjoy here, is not a new xyz-theme for a php based blog software. No! I managed to get Ghost up and running on my VPS. My old wordpress is still available: old-blog.raoulkramer.de.

get started

I started here but my hosting is running Plesk 17.x, so I have Node.jS Support within Plesk and do not need the npm/nvm installation.

secure your ghost installation

I start at the end, after downloading, unzipping, installing and having set up Ghost, I found my config.js and the ghost.db sqlite file public accessible, because I configured the app wrong in Plesk.

Before you click Enable Node.js make sure your configuration looks something like this:

Document Root != Application Root

Your Document Root must point into an empty directory in your Application Root. If your Document Root is equal to your Application Root, your sqlite file and your config.js is public.

Keep that in mind, we now can set up Ghost with Plesk 17.x :-)

Setup Ghost with Plesk 17.x (plesk onyx)

Activate NodeJS Support

First you need to activate the NodeJS Support in Plesk. Ghost needs NodeJS 6.x (or 4.2.x) - I use NodeJS 6.9.1:

Add/Enable NodeJS support in your Plesk Installation

You find that menu under Tools & Settings > Updates and Upgrades and on the new opened page Add/Remove Components. Just hit Continue after enabling NodeJS Support.

Create (Sub-)Domain for your Ghost Installation

Create a Domain or Subdomain, where you want to run your Ghost Blog, and have a look for the NodeJS Configuration:

Click the NodeJS button in your Domain Settings

Download and unzip Ghost

Open a Terminal and connect via ssh with your server. In my opinion this is the easiest way to perform the next step: download the latest ghost bundle:

% ssh <your-ssh-web-user>@<your-domain-or-ip>
~$ curl -L https://ghost.org/zip/ghost-latest.zip -o ghost.zip
~$ unzip -uo ghost.zip -d ./httpdocs

This downloads the latest ghost bundle into the home directory of your web user. This is a not publicly accessible directory. From this directory, I unzip the bundle right into my domain root.

If you do not like the shell, you can download Ghost to your local machine and upload it with Plesk and unzip it:

Plesk File Manager with Extract Files Support

After this I configure ghost:

~$ cd httpdocs/
~$ mv config.example.js config.js
~$ vim config.js

vim config.js

and configure the app on Plesk:

Setup the NodeJS Environment for Ghost

As you can see Document Root points to /httpdocs/app.

When everyrhing is set, click Enable Node.js, which will change this interface a bit:

Plesk Panel with activated NodeJS

where to npm install?

When you ssh login to your server, you'll see that your shell does not recognize any npm command 😥

But in Plesk, you will see a button called npm install in your NodeJS settings:

NPM Install Button

If this Button is not visible, your application root does not have a package.json in it.

you're done!

After hitting npm install with NodeJS Version 6.9 (or 4.x) you can hit the restart app button and your ghost installation is up and running.

Visit http(s)://yourdomain.tld/ghost and create an owner account. Happy blogging!

But…
…you may consider the following points for your shiny new blog:

SSL it!

When you're running a Plesk 17.x installation, you can secure the communication with your site with a free ssl certificate from Let's encrypt:

click the let's encrypt button

If you are running an older version of plesk (12.5) you can add the lets encrypt plugin, I highly recommend this, nothing is cooler than a ssl website.

mySQL it?

I think mySQL is a bit faster than sqlite, but I did not run any benchmark about that. So if you do want to do this (mysql as db engine, not the benchmark thing), here is the documentation for that.

If you start a new ghost blog, you do not need to import anything from sqlite to mysql 😉

And now?

Happy blogging!