Keep Ghost running Forever

Using Forever to keep Ghost running

In my previous post I walked you through how to get Ghost up and running on the GoDaddy cPanel shared hosting platform. However, the largest caveat of that setup is that if your node process is killed for whatever reason you would need to manually log back in via SSH and restart Ghost. Luckily you can avoid all of this by using the 'Forever' npm module to daemonize your Ghost installation so that it will automatically restart should the process die. Setup is simple and straightforward.

Install and use Forever
  1. Log in to your hosting account via SSH
  2. Install the forever npm module
    npm install forever
  3. Change to your Ghost directory and run:
    NODE_ENV=production forever start index.js
  4. Complete!

It's worth noting that without the NODE_ENV=production bit above you'll likely not have an accessible Ghost site. As you can likely guess this part sets the node environment to production, which should be the configuration you'll want to load by utilizing the production section of your config.js.