in Information Technology ~ read.
The easy way to setup a ghost blog (behind apache server)

The easy way to setup a ghost blog (behind apache server)

Wordpress is a great tool to build websites. In my opinion, it became too powerful (= complicated) for a simple blog. Therefore, I decided to research alternatives for my new blog.

After some research, I decided to utilize Ghost. My main criteria were:

  • Minimalistic
  • Self-hosted
  • Uses modern technology
  • In active development
  • Open source

There are two options to use Ghost: 1) Ghost Pro or 2) Ghost self-hosted

In following you can find a description to create a self-hosted Ghost Blog on a Ubuntu 14.04 LTS Server.

Step 0 - Pre-Setup

Install Apache and node.js

# sudo apt-get nodejs apache2

enable proxy in apache

# sudo a2enmod proxy

Step 1 - Create and change to a folder on your Ubuntu 14.04 LTS Server

# mkdir /var/www/myghostblog
# cd /var/www/myghostblog

Step 2 - Download latest ghost blog version

# curl -LOk https://ghost.org/zip/ghost-latest.zip

Step 3 - Extract ghost blog files

# unzip ghost-latest.zip

Step 4 - Configure Ghost files

# cp config.example.js config.js

Step 5 - Changes in config.js

# vi config.js

Change the following

production: {  
        url: 'http://www.myghostblog.org',
      [...]
        },

        server: {
            host: '0.0.0.0',
            [...]
        }
    },

Step 6 - Run as a process

# sudo curl https://raw.githubusercontent.com/TryGhost/Ghost-Config/master/init.d/ghost \
  -o /etc/init.d/ghost
# sudo useradd -r ghost -U
# sudo chown -R ghost:ghost /var/www/myghostblog
# sudo chmod 755 /etc/init.d/ghost

Step 7 - Proxy Ghost blog traffic through apache

Add the following in your vhost file in apache

# vi /etc/apache2/sites-available/myghostblog.org.conf

and add

<VirtualHost *:80>  
     ServerName myghostblog.org
     ServerAlias www.myghostblog.org
     ServerAdmin blog@myghostblog.org
     DocumentRoot /var/www/blank
     RewriteEngine On
     RewriteCond %{HTTP_HOST} !^www\. [NC]
     RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
     ProxyPass / http://localhost:2368/
</VirtualHost>

enable site, start ghost blog and restart apache

# service ghost start
# a2ensite myghostblog.org
# service apache2 restart

Now the blog is setup and running.

Let's auto-start ghost - just in case the server gets restarted

# update-rc.d ghost defaults
# update-rc.d ghost enable

You have question about this post or you would like me to write more about a similar topic? Leave a comment or E-Mail me at Blog@Steven-Geller.com

comments powered by Disqus