How To Keep Ghost Running With pm2

Article By steve


ghost VPS BIP media hosting

Introduction to Ghost

When installing manually on a VPS, most people wonder how to keep Ghost running after their terminal session has ended. There are multiple ways to do this, the most popular way currently being forever and pm2 is a great alternative. It's Very easy to setup and use. Here are the steps to installing pm2 with Ghost:

Note: These commands should be run from a non root user that is dedicated to running this process.

cd /path/to/ghost/folder
sudo npm install -g pm2
echo "export NODE_ENV=production" >> ~/.profile
source ~/.profile
pm2 kill
pm2 start index.js --name ghost
pm2 dump
pm2 startup 

In the last command you will need to set the start up mode based on your operating system. For example if you are running in Amazon then your command will be: pm2 startup amazon.

Once you have it up and running with pm2 some other useful pm2 commands are:

  • pm2 status
  • pm2 stop
  • pm2 monit
  • pm2 logs pm2 status command will allow you to see some useful status. Three useful things to note from the command will be the id, Uptime, and err logs columns. These are very valuable.

The pm2 logs command will give you live output.

And the pm2 monit command will give you live status on the memory footprint.

If you want more information on pm2, here is a link to their GitHub page.  

Tags: , , , , ,

Spin Up A VPS Server In No Time Flat

Simple Setup

Full Root Access

Straightforward Pricing


Leave a Reply