Configuring Ghost to work with Apache proxy

Hi Gents.

In the Transition from WordPress to Ghost post I promised to tell how I configured Ghost, to work on Linux with already configured and running on port 80 Apache HTTP web server.

There are several options for installation, but I have AWS EC2 instance with Ubuntu and already running another WordPress blog. And I can’t change that blogging platform, because it is used by another person.

So here is my instruction how to install Ghost blogging platform on Ubuntu server with already running web server Apache.

1. Install Node.js

At Least from Ubuntu 12.04, an old version (0.6.x) of Node is in the standard repository. To install, just run:

sudo apt-get install nodejs

Obtaining a recent version of Node or installing on older Ubuntu and other apt-based distributions may require a few extra steps. Example install:

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

It installs current stable Node on the current stable Ubuntu. For other OS Node installation look here.

2. Install Ghost

I used the following command to download the latest release of Ghost:

$ curl -L -o

Unziped the archive and change into the directory using the following:

$ unzip -uo -d ghost

Then several config and installation steps:

$ cd /path/to/ghost
npm install --production
$ npm start

3. Init Script

To make Ghost run forever and even survive a reboot I set up an init script to accomplish that task.

$ sudo curl \ -o /etc/init.d/ghost

And in /etc/init.d/ghost I changed GHOST_ROOT variable to the installed ghost folder.

Then executed several somands about permissions and owners:

$ sudo useradd -r ghost -U
$ sudo chown -R ghost:ghost /path/to/ghost
$ sudo chmod 755 /etc/init.d/ghost

And now I am able to run next commands:

$ sudo service ghost start
$ sudo service ghost stop
$ sudo service ghost restart
$ sudo service ghost status

To start Ghost on system start the newly created init script has to be registered for start up:

$ sudo update-rc.d ghost defaults
$ sudo update-rc.d ghost enable

4. Apache Proxy

I unstalled moproxy Apache module:

apt-get install mod_proxy

And enabled proxy_http:

sudo a2enmod proxy_http

And added next configuration to the virtual host for my domain:

    ProxyRequests off

    <Proxy *>
            Order deny,allow
            Allow from all

    <Location />
            ProxyPass http://localhost:2368/
            ProxyPassReverse http://localhost:2368/

Restarted Apache and I was done!

That is it! Thanks for reading.

Andrew Kovalenko

Developer & Team Lead

Kiyv, Ukraine