How to Deploy Ghost on Debian 8.7

Using a Different System?

  • How to Deploy Ghost on Ubuntu 16.04

  • How to Deploy Ghost on CentOS 7.3

  • How to Deploy Ghost on Fedora 25

  • How to Deploy Ghost v0.11 LTS on Ubuntu 16.04

Are we missing a guide for your target system? Request one, or submit your own!

Ghost is an open source blogging platform that is gaining popularity among developers and ordinary users since its 2013 release. It puts focus on content and blogging. The most attractive thing about Ghost is its simple, clean, and responsive design. You can write your blog posts from a mobile phone. Content for Ghost is written using the Markdown language.

In this guide we are going to set up and deploy Ghost blog on an Debian 8.7 VPS using Let’s Encrypt, Node.js and Nginx.

Let’s Encrypt (Certbot)

Before starting this step, ensure that you have set DNS records for your domain.

  1. Update system:

    apt update && apt upgrade -y
  2. Install needed tools:

    apt install -y zip build-essential
  3. Enable the Jessie backports repo. Run apt edit-sources and paste the below line at the end of /etc/apt/sources.list file:

    # Copy/Paste the below line at the end of filedeb jessie-backports main
  4. Refresh package sources:

    apt update
  5. Install Certbot (a.k.a Let’s Encrypt client):

    apt install -y certbot -t jessie-backports
  6. Check version:

    certbot --version# certbot 0.9.3
  7. Obtain certificate:

    certbot certonly -d -d --email --agree-tos --standalone

    After going through previous steps, your certificate and private key will be in the /etc/letsencrypt/live/ directory.

Install NodeJS

Ghost currently supports Node versions 0.12.x, 4.2+, and 6.9+ only.

We are going to install the recommended version for Ghost which is v4 argon LTS at the time of this writing.

  1. Download and install the LTS version of Node.js:

    curl -sL | sudo -E bash -apt install -y nodejs
  2. Check Node and NPM version:

    node -v && npm -v# v4.7.2# 2.15.11

Install Nginx

  1. Download and install Nginx:

    apt install nginx -t jessie-backports
  2. Check the Nginx version:

    nginx -v# nginx version: nginx/1.9.10
  3. Start Nginx service and check status:

    systemctl start nginxsystemctl status nginx
  4. Configure Nginx as a reverse proxy:

    vi /etc/nginx/conf.d/ghost.conf
  5. Paste the following in /etc/nginx/conf.d/ghost.conf:

    server {    listen 80;    listen [::]:80;    listen 443 ssl http2;    listen [::]:443 ssl http2;    server_name;    ssl_certificate /etc/letsencrypt/live/;    ssl_certificate_key /etc/letsencrypt/live/;    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;    location / {        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;        proxy_set_header Host $http_host;        proxy_set_header X-Forwarded-Proto $scheme;        proxy_pass;    }}
  6. Check syntax:

    nginx -t
  7. Reload Nginx:

    systemctl reload nginx

Install Ghost

If you want to host multiple Ghost blogs on the same VPS, each Ghost instance must be running on a separate port.

  1. Make the webroot directory:

    mkdir -p /var/www/
  2. Create a Ghost user:

    adduser ghost
  3. Download and install Ghost:

    cd /var/wwwwget -d ghostchown -R ghost:ghost /var/www/ghost/rm
  4. Switch to the ghost user:

    su - ghost
  5. Install Ghost:

    cd /var/www/ghostnpm install --production
  6. Configure Ghost by changing the url property of the production object inside of the config.js file:

    cp config.example.js config.jsvi config.jsconfig = {// ### Production// When running Ghost in the wild, use the production environment.// Configure your URL and mail settings hereproduction: {    url: '',    ...}......

    NOTE: You should configure mail also. Consult the official Ghost documentation on how to do that.

  7. Save config.js file and exit.

  8. Start Ghost:

    npm start --production

    Ghost is now running on your server. Both blog front-end and admin interface are secured with HTTPS and HTTP/2 is working also. You can open your browser and visit your site at Don’t forget to replace with your domain name.

Keep Ghost running

If you close the terminal session to your VPS, your blog will also go down. That’s not good. To avoid this, we are going to use the Forever process manager. That will keep your blog up 24/7.

  1. Switch to the ghost user:

    su - ghost
  2. Go to the /var/www/ghost folder:

    cd /var/www/ghost
  3. Install Forever:

    npm install forever
  4. Add the new forever command to your path:

    echo "export PATH=/var/www/ghost/node_modules/forever/bin:$PATH" >> ~/.bashrcsource ~/.bashrc
  5. Start Ghost with Forever:

    NODE_ENV=production /var/www/ghost/node_modules/forever/bin/forever start index.js

    At this point, forever should have started Ghost.

  6. Go to and create a Ghost admin account. Do this as soon as possible.


That’s it. We now have a fully functional Ghost blog. If you want to change the default Ghost theme called Casper to a custom one, you can just download and unzip the theme into the /var/www/ghost/content/themes folder and select it via Ghost admin interface, located at

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article

No comments

Powered by Blogger.