This setup is made possible by a combination of the following posts:


First up you are going to need to install Apache and Nodejs for your Ghost blog. SSH or connect to your service that will host your Ghost site. In terminal enter the following:

sudo apt-get update
sudo apt-get install apache2

apt-get install -y python-software-properties python g++ make
add-apt-repository -y ppa:chris-lea/node.js
apt-get update
apt-get install nodejs

You should note, this is a rather slapstick way of installing node. Another option would be to use nvm, or better download the latest binaries from the nodejs site and install it on your server. Since I use digital ocean though I was able to provision my server with nodejs pre-installed.

Install Ghost

Lets install ghost now. Idealy its best to follow the instructions straight from the Ghost Github Repo. But generaly this is what is happening:

Run the following commands

cd ~/
sudo mkdir ghost-blog
unzip -uo

npm install --production

You'll be now installing ghost onto your system along with all of its dependencies it uses from node

Configure Ghost

Time to edit Ghosts config files

sudo nano ./config.js

Within this file is preset a number of default configurations. Take a read through the file and change options if you would like. It may be ideal to also configure email settings. Not doing so only shows a warning in the control panel when ghost starts and you can set it later and test it again as well from the control panel. At minimum change the url in the production section to the name of your website. Don't forget https!

production: {
    url: "",
    mail: {}

Save the config file and your configuration days are over

Run Ghost

Lets get ghost running. Were also going to setup Foreverjs which is a simple node module that will restart ghost if it crashes. Enter the following commands:

npm install -g forever
NODE_ENV=production forever start index.js

Alternatively if you don't want to use forever you can start Ghost with this command:

npm start --production

Configure Apache

If you wandered through the config.js you'll have seen that ghost by default will load on localhost:2368. This is not externally accessible, so we are going to configure apache to make a proxy to redirect the outside world to our ghost server. Enter the following commands:

cd /etc/apache2/sites-available
sudo nano 000-default.conf

This opens the apache config. Add the following to the bottom of the page but replace the ServerName and ServerNameAlias with the correct information. Also note this is where we are enforcing SSH. You will need to replace the SSLCertificateFile and SSLCertificateKeyFile values with the directories to your certificate and key

<VirtualHost *:443>

    ProxyPass / http://localhost:2368/
    ProxyPassReverse / http://localhost:2368/

    SSLEngine On
    SSLCertificateFile /etc/ssl/certificate.crt
    SSLCertificateKeyFile /etc/ssl/key.key

    RequestHeader set X-Forwarded-Proto "https"
    ErrorLog ${APACHE_LOG_DIR}/blog_error.log
    CustomLog ${APACHE_LOG_DIR}/blog_access.log combined


Notice that we have added the X-Forwarded-Proto header and gave it the value "https". This is so that Ghost is able to tell that this connection request is comming in as https, in which case it will then serve its content in https. If this was not included, Ghost would redirect to https but then be stuck in a loop and continue to fail. If you get the error message ERR_TOO_MANY_REDIRECTS it is probably because of this problem.

Lets now add a virtual host for if users try to go to our website with http. For security were going to force all connections to be https. So to do that we need to setup apache to redirect all connection attempts in http to https. Add the following to the bottom of the 000-default.conf file we have been just editing

<VirtualHost *:80>

    Redirect permanent /

Once again, replace the ServerName and serverAlias with the url of your website and change the url in the Redirect section to the https url of your website

Now save your changes. Now for these changes to take effect, we need to restart apache. Before this though we need to enable the modules used for SSH, Proxy, and RequestHeader. Enter the following commands:

a2enmod proxy_http
a2enmod ssl
a2enmod headers

Now lets restart apache

sudo service apache2 restart

And for extra measure lets also restart Ghost

forever restartall

Or if you are not using forever

cd ~/ghost-blog
npm start --production

Use Ghost

Ghost is now ready. Go to your browser and checkout the url you set in apache. Using the above examples mine would be . This will load the sample home page. To further configure your blog go to /ghost to begin setting up your account