How to install and configure Ghost Blog on Ubuntu 16.04

Install - configure Ghost blog on openSUSE 42.2 Leap


Ghost blog is a blogging and publishing platform, totally open source and written in JavaScript, using the Node.js framework. As stated on the official website, “the inventors of JavaScript, Android and StackOverflow all use Ghost for their blogs”.

This tutorial explains how to install and configure Ghost on an Ubuntu 16.04 Server.

Getting started – Install Node.js

It is possible to install Node.js using NodeSource binary distributions repository. To accomplish this task, execute the following commands:

$ curl -sL | sudo -E bash -
$ sudo apt-get install -y nodejs

Install build tools, required for building and installing npm, with apt:

# apt-get -y install build-essential

Install Ghost

If it doesn’t already exist, create the directory /var/www/:

# mkdir -p /var/www/

There, download Ghost, grabbing the latest version from

# cd /var/www
# curl -L -o

Next, unzip the downloaded archive:

# unzip -uo -d ghost

Move to the new ghost directory, and install Ghost using npm:

# cd ghost
# npm install --production

This is a very fast process, and is totally automated. At the end, Ghost will be correctly installed on the server. Start Ghost (for this moment, just for testing) :

# npm start --production

By default, Ghost runs on http://localhost:2368

Open a web browser and go to the previous URL. It should display the Ghost Welcome Page

Ghost Welcome page

In the terminal used for starting Ghost, the process should display a WARNING message:

WARNING: Ghost is attempting to use a direct method to send email.
It is recommended that you explicitly configure an email service.

Right now, this is not a problem and can be ignored. Stop the process with CTRL+C.

Ghost configuration

First of all, create a new user used to run Ghost with the following command:

# useradd -d /var/www -s /bin/bash ghost
# passwd ghost

Change the owner of the Ghost root directory:

# chown -R ghost:ghost /var/www/ghost

After running Ghost for the first time, looking in its root directory you should see different files. We are interested in the one named config.js .

If you haven’t yet run Ghost for the first time, you will see only config.example.js. Copy it:

# cp config.example.js config.js

Open this file with a text editor:

# $EDITOR config.js

In that, we are interested in the production block:

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

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

This is the default. We will change it after configuring the server.

Install and configure Apache Web Server

Install Apache with apt:

# apt-get install apache2

Next, enable SSL for Ghost. To do this, create a directory which will contain the SSL certificates:

# mkdir -p /etc/apache2/certs

Generate the certificate (self-signed) with OpenSSL, executing the command:

# openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout /etc/apache2/certs/ghost.key -out /etc/apache2/certs/ghost.crt

Change permissions on the certificate file:

# chmod 600 /etc/apache2/certs/*

Next step is to create a new Virtual Host file for Ghost. With a text editor, create a new file:

# $EDITOR /etc/apache2/sites-available/ghost.conf

In this file, paste the following content:

<VirtualHost *:80>
    # Force http to https
    Redirect permanent /
#    ProxyRequests off 
#    ProxyPass / 
#    ProxyPassReverse / http:/     

<VirtualHost *:443>


   SSLEngine on
   SSLCertificateFile /etc/apache2/certs/ghost.crt
   SSLCertificateKeyFile /etc/apache2/certs/ghost.key

   ProxyPass /
   ProxyPassReverse / http:/
   ProxyPreserveHost   On

   RequestHeader set X-Forwarded-Proto "https"


Save, exit, and activate the SSL Apache module with the following command:

# a2enmod ssl headers

Next, restart Apache:

# systemctl restart apache2

Edit Ghost configuration file

Open the config.js file we have already seen:

# $EDITOR /var/www/ghost/config.js

Change the URL line in the production block, as follows:

url: ''

Save and exit. With this change, all requests made via plain HTTP will be redirected to HTTPS.

Create a new systemd service for Ghost

To make it easier to start Ghost, we will create a new systemd service. With a text editor, create a new file:

# $EDITOR /lib/systemd/system/ghost.service

In this empty file, paste the following content:

Description=Ghost - Blogging platform

ExecStart=/usr/bin/npm start --production
ExecStop=/usr/bin/npm stop --production


Save and exit.

Reload the systemd daemon:

# systemd daemon-reload

Using systemd, start Ghost and enable it to start at boot time:

# systemctl start ghost
# systemctl enable ghost

Now, with a web browser, go to URL and you should see the Ghost Welcome Page.


Ghost is an easy to configure blogging and publishing platform, used by many companies worldwide, like Mozilla and SkyNews. It’s a free and open source software which makes it possible for anyone to easily create a new blog. In this tutorial, we have shown how a full installation and configuration can be completed in just a few steps, using Ubuntu 16.04 and Apache as your web server. Blog away!

  • I got started freelancing over world wide web, through some necessary projects which mainly demanded a laptop or computer together with having access to net and additionally I am more happy than before… six months time have passed when i started out this and additionally i received profit total of $36,000… Normally I earn 80 usd each one hr and also work for three to four hrs nearly all the times.And attractiveness of this is exactly that one could manage precious time whenever you work and also for how long as you like but you still gain a take-home pay a week. —->>>LEARN A lot more About That here-> GOCHIURL.COM/15d91