Launch Ghost Blog on Plesk

This article focuses on installing Ghost Blog directly from Github into Plesk Obsidian.

Getting Started

The screenshot below demonstrates various tools to deploy Ghost Blog on Plesk. The tools are mostly plug-and-play, but there are a few of them.

plesk-git-application

plesk-git-application-hosting

Step 0 – Manage DNS

The first step is to verify that your domain name is pointing to your DNS. This article will not cover these steps, but there are tons of articles on Google if you query connect a domain to DNS on Plesk.

Step 1 – Manage SSL Certificates

Plesk integration with Let’s Encrypt makes it very easy to create a new SSL certificate for free.

plesk-create-ssl-certificate

Step 2 – Manage Database

Create a database for the blog itself. You will need the database name, username, and password later.

plesk-create-db-config

plesk-databse-verify

Step 3 – Build Ghost from Source on Local Computer

Install knex-migrator and ember-cli globally.

 yarn global add knex-migrator ember-cli

Clone Ghost from Github and include the submodules Admin and Casper theme.

 git clone --recurse-submodules [email protected]:TryGhost/Ghost && cd Ghost

Despite Git posts titled ‘No More Grunt’, grunt is still used.

 npm i grunt --force
 npm audit fix --force

This command uses yarn to install your NPM packages, knex-migrator to configure your database and grunt to kickstart even more magic.

 npm run setup

Substep A – Build App

This command will compile key files that live in /core/built/*.

 npm run build

Substep B – Modify for Plesk

Plesk requires an /app directory so it’s just easier to add it in right now.

mkdir app
echo 'scripts-prepend-node-path=true' >> .npmrc

Substep C – Package for Prod

The zip file is missing assets files within /core/built/* so we’ll need to build them.

Lets compile your app for production.

grunt release --zip
open ./dist/release

Step 4 – Manage File Manager

Visit Plesk’s File Manager tool and select httpdocs folder. Drag the zip file into the directory

Substep A – Upload & extract zip

You can drag your zip file over to the /httpdocs folder within file manager.
plesk-drag-zip-file-to-htdocs-01-1

plesk-drag-zip-file-to-htdocs-02-1

When you extract the files, make sure the extracted files are on the /httpdocs folder (not in a Ghost folder).
plesk-drag-zip-file-to-htdocs-03

Substep B – Create .npmrc

Create a new file name “`/httpdocs/.npmrc“. Then insert this line of code.

scripts-prepend-node-path=true

plesk-create-npmrc

Note: The reason why we’re adding a hidden file here –and not in a previous step– has to do with Grunt. Grunt often ignores hidden files but I don’t want to mess with Grunt files at all.

Substep C – Create /httpdocs/app

Create a blank app folder within httpdocs. The final result will look like this => /httpdocs/app.

Substep D – Edit /core/shared/config/defaults.json

Visit /core/shared/config/ folder and edit these two files.
plesk-edit.core.shared.config.defaults.json

plesk-configure.defaults.json

Substep E – Edit config.production.json

plesk-core.shared.config.env.production.json

config.production.json

Step 6 – Manage Node.JS App

Visit Plesk’s Node.JS tool and enable the application.

Substep A – Set Version of NodeJS

Currently, Ghost Blog is using Node version 14.x.x.

Substep B – Configure Document Root

Select /httpdocs/app for Document Root.

Substep C – Configure Application Root

Select /httpdocs/ for Application Root.

Substep D – Configure Application Startup File

Change the startup file of the Node.js application to index.js.

Substep E – Install Packages

Select the “[NPM Install]” button to install the NPM packages Ghost Blog requires.

Substep F – Run Ghost Setup

Select the “[Run Script]” button, type setup, and select “[Run]” to install and build the application.

plesk-run-yarn-setup

node-run-script

Substep G – Restart NodeJS App

Select “[Restart App]” to get things working.

Step 7 – Done!

Visit https://www.mywebsite.com/ghost to complete your application installation.

Cloudflare Warning

It is recommended that you add a page rule which turns off some RocketLoader, mirage2 and autominify for the path /ghost*, so these features don’t affect the Ghost admin panel.

cloudflare-ghost_hu3292e1ab34393a3f83860fc03720b502_39786_791x0_resize_q100_h2_box_3

Resources