May 17, 2016 · Node.JS Setup Guides ·

Setting up a Blog Using Ghost on Ubuntu 14.04


Ghost is a sleek open source blogging platform based on NodeJS. If you are a developer in need of an easy to use, no-nonsense platform, Ghost is a very good option for you.

In fact, I am running this blog on Ghost! Check out this shot of the editor:

In this guide, I'll show you how I got it to run on my Ubuntu 14.04 box, as well as some hurdles I ran into.


1. Dependencies

  • Node.js and npm (<5.0)
  • forever - sudo npm install forever -g
  • Nginx
  • wget - sudo apt-get install wget
  • unzip - sudo apt-get install unzip

2. Download and Extract Ghost

Inside your code directory (I like to keep my code under /home/benjiao/code):

cd /home/benjiao/code

unzip -d

3. Install Node.js dependencies

npm install --production

Note: If this fails, please refer to Issues section below

4. Configuring Your Ghost Blog

Duplicate the included config file template.

cp -Rpv config.example.js config.js

Then open config.js in your text editor and change the url field into your own blog name.

    production: {
        url: '',
        mail: {},
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost.db')
            debug: false

        server: {
            host: '',
            port: '2368'

5. Run it!

This will run the blog on port 2368 by default.

npm start --production

6. Setup Forever

Forever is a service that allows you to run Node.js apps on the background. It also restarts the scripts in case of any unexpected crashes.

To run it in production, simply do:

NODE_ENV=production forever -a --uid start index.js

To check if it is running, run:

forever list

7. Setup Nginx

It is good practice to setup Nginx as a Reverse Proxy for Node.js apps.

Here's a quick overview of how I set it up:

a. Create a new config file for my new site

sudo vim /etc/nginx/sites-available/

b. Tell Nginx to forward requests to Port 2368. Inside the config file:

server {
    listen 80;

    location / {
        proxy_pass http://localhost:2368;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

c. Make our new config file visible to Nginx

sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/

d. Restart Nginx

sudo service nginx restart

8. DONE!

If everything went well, your site is now being served at port 80. Congratulations!

...if not, please feel free to drop a comment or checkout the issues section below.


Just some hiccups I encountered

1. I was running Node 6.0

On my first run of npm install, it was failing. It turns out, Ghost does not support Node.js version 5.0 and above.

$ node --version

I resolved this by installing n, a version control manager for Node and use it to revert to version 4.2

sudo npm install -g n
sudo n 4.2