This post assumes the following:

  • A server running Ubuntu 16.04 LTS adequately configured
  • SSH/command-line access with root privileges

Kick things off with an update
sudo apt-get update

Next, install git and unzip, we'll need these later.
sudo apt-get install git unzip


If your server has lower memory like 512MB, you'll need a swap file for memory overruns.

fallocate -l 1G /swapfile

chmod 600 /swapfile

mkswap /swapfile

swapon /swapfile


Ghost runs on node.js so let's get it installed:
sudo apt-get install nodejs

Install the symlink legacy fix
sudo apt-get install nodejs-legacy

Install the Node Package Manager
sudo apt-get install npm

You can now check your node and npm versions by node -v and npm -v


Nginx is a smoking fast webserver and proxy, among other things. To get it installed:
sudo apt-get install nginx

Now to setup the server-blocks. Create a new file named ghost inside the nginx sites folder.
nano /etc/nginx/sites-available/ghost

Add the following server-block, update your blog URL, then ctl+X to exit and Y to save.

server {  
    listen 80 default_server;                                                                                                                                
    listen [::]:80 default_server ipv6only=on;                                                                                                               

    server_name blog.yourwebsite.URL;                                                                                                                          

    client_max_body_size 10G;                                                                                                                                

    location / {                                                                                                                                             
        proxy_pass http://localhost:2368;                                                                                                                    
        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_buffering off;                                                                                                                                 

This will proxy your blog URL to your local server on port 2368 where ghost runs.

Now we can symlink this file to the sites-enabled folder by:
ln -s /etc/nginx/sites-available/ghost /etc/nginx/sites-enabled/

Now restart nginx to apply these changes.
sudo service nginx restart

If you didn't get an error, onward to ghost!


Ghost docs recommend installing to the folder /var/www/ghost so we'll use that. /var/www/ likely already exists, if not make it by
mkdir /var/www/

Now switch into that directory by
cd /var/www/

Then grab the latest version of ghost:
curl -L -o

Unzip that file
unzip -uo

Jump into the unzipped directory
cd ghost

Run the installer
npm install --production

Note: if you get a "killed" process here and didn't install a swap file, I'd retry this after creating the swap

Now jump into the config file and update the URL and email service.
nano /var/www/ghost/config.js


There are several options for long running services like pm2 and forever, but I am using Supervisor for this post.

Install it
apt-get install supervisor

Start it up
service supervisor start

Create a conf file for ghost
nano /etc/supervisor/conf.d/ghost.conf

command = node /var/www/ghost/index.js  
directory = /var/www/ghost  
user = root  
autostart = true  
autorestart = true  
stdout_logfile = /var/log/supervisor/ghost.log  
stderr_logfile = /var/log/supervisor/ghost_err.log  
environment = NODE_ENV="production"  

You can replace root with your current user.

Reboot for the new conf
service supervisor restart

Start ghost
supervisorctl start ghost

In the future to stop the process you simply replace start with stop

Ghost should now being running. Jump over to your blog URL and run through the initial setup.


Remember that we installed git? It was for easy theme installations. If you jump over to github or just search google you can find numerous free ghost themes. Installing them from github is super easy.

Jump in to the themes directory
cd /var/www/ghost/content/themes/

Clone the theme
git clone *theme git URL*

Now activate it in the admin area under general settings.