This page is indebted to

Before we start

Make sure your router is forwarding HTTP requests on port 80 to the ip-address you will be assigning to your Raspberry Pi and your DNS entries for your sub-domain are correctly accessing your router's external ip-address

Install Raspian Lite on the Raspberry Pi

I like to use Etcher to write SD cards.
Remount the SD card and create a blank file ssh in the Boot partition
On the Main partition edit /etc/dhcpcd.conf - you may need to switch to Root to do this. Append the following lines:

interface eth0

static ip_address=
static routers=
static domain_name_servers=

Where: ip_address is the ip_address you plan to use for your Ghost server, and routers/domain_name_servers are the IP address of your router.

Insert the SD card in the Raspberry Pi and boot

Update the Raspberry Pi

SSH into the Raspberry Pi at the address you used above with the user-id of pi and password raspberry

sudo apt-get update && sudo apt-get upgrade
sudo raspi-config
  • Change Pi Password
  • Change Hostname
  • Enable SSH
  • Expand Memory
  • set memory split to 16MB

Install nginx

sudo apt-get install nginx

Edit /etc/nginx/nginx.conf

  1. increase server_names_has_bucket_size to 64
    necessary for ghost
  2. add client_max_box_size 2m; (i the same section)
    Some ghost themes are quite large and need this to be able to be uploaded

Restart nginx sudo service nginx restart and browse to the IP address of the Raspberry Pi to confirm nginx is working OK

Install nodejs

Install version 6.9.5 which is the latest fully suppoprted version of node.js for ghost

sudo mv node-v6.9.5-linux-armv7l.tar.gz /opt
cd /opt
sudo tar -xzf node-v6.9.5-linux-armv7l.tar.gz 
sudo mv node-v6.9.5-linux-armv7l nodejs
sudo rm node-v6.9.5-linux-armv7l.tar.gz
sudo ln -s /opt/nodejs/bin/node /usr/bin/node
sudo ln -s /opt/nodejs/bin/npm /usr/bin/npm

Verify the install with node -v

install ghost for your target subdirectory

I want to use a subdomain of 'travels'

cd ~
sudo mkdir /var/www/travels
sudo chown -R pi:pi /var/www/
sudo unzip -d /var/www/travels
cd /var/www/travels/
npm install --production
sudo chown -R pi:pi /var/www/

This takes some time - there may be an error message because there is no pre-built sqlite3 - this is not a problem, the build process will continue and compile sqlite3 from source

Basic ghost configuration

cd /var/www/travels/
cp config.example.js config.js

nano config.js

  1. In the Production section
    • Change url: to the URL of your subdomain/domain
      (e.g. url:
    • Change the server/host: to your ip-address
      (e.g. host: '')
  2. In the Development section
    • Change the server/host: to your ip-address
      (e.g. host: '')

Test the Production environment
npm start --production' and navigate to port 2368 at your ip-address in a browser (e.g.

Similarly test the development environment - npm start --development

NOW - go back and edit config.js again and change both the host: fields you just changed, back to their original value of ready for integration with nginx

Add proxy for nginx

cd /etc/nginx/sites-available/ and create a new config file:
sudo nano travels.conf

The contests of the config file should be:

server {
    listen 80;
    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;

And link into sites-enabled:
sudo ln -s /etc/nginx/sites-available/travels.conf /etc/nginx/sites-enabled/travels.conf

Restart nginx - sudo service nginx restart
Start ghost for your subdomain

cd /var/www/travels
npm start --production

You should now be able to navigate to your site's URL and see ghost running.

Next - Deploying Ghost at start-up