Migrating Ghost Blog, Installing in Directory

May 12, 2014 00:00 · 309 words · 2 minute read Apache Ghost Blog

Previous to this I had been experimenting with ghost blog on my personal server. The one thing I that bummed me out was the inability to put the blog in a subfolder on a site. I hosted the blog at home and made my website link to it. This worked for the time being, but eventually became a bit of a pain. I got a message to upgrade my installation and found in the release notes that there was now the ability to add ghost into a subdirectory, my prayers were answered. I also used this as a good excuse to finally purchase a digital ocean droplet. I like to run Ubuntu 12.04 but one thing I found out, after about an hour of fiddling around, is that new Ubuntu droplets need to have a swap file added. I followed the following guide to get it set up so I could pull in my git repo and get to work on setting up my blog. After setting up a vhost for my domain all I had to do was one extra step to the normal installation of a ghost blog. I had to add the following code to the vhost file for my domain:

<IfModule mod_proxy.c>
    ProxyPreserveHost On
    ProxyPass /blog/
    ProxyPassReverse /blog/

I created a new tmux session and booted up the ghost blog and saw success! It really worked that easy. Now all I had to do was import the data from my old blog into my new one. Ghost has an awesome feature where you can go blog/ghost/debug and it will give you a nice screen where you can export all your data into one nice file and then go to the same page on the other blog and import it. Boom! new blog up and running in a subdirectory on my new droplet.