From Wordpress to Ghost
In this post I'll explain why and how I moved my blog from Wordpress, wich I really liked, to Ghost, wich I like just a bit more. Due to the topic this post will be in english.
tl;dr: As you can see, it works. And the migration went really well.
To get an overview up front here are the steps I went thru. But be aware, that I assume your server already meets the requirements by ghost. By which I mean node.js is running.
- Installed ghost
- Added a proxy to ghost in apache
- Installed ghost plugin for wordpress
- Exported data from wordpress via ghost plugin
- Altered paths in exported json to match new folder structure
- Migrated images from Wordpress to Ghost
- Let ghost run "forever"
I installed version 0.7.8 of ghost on my ubuntu machine by following the instructions under http://support.ghost.org/installing-ghost-linux/. No magic here. Thou ghost recommends node 0.10.x and my machine is running 4.3.1 which was the latest LTS version at the time i updated it. (At the time of writing the latest LTS version is 4.4.2). Trying to run ghost on node 5.x will make ghost complain to use a LTS version.
Adding proxy pass to Apache
My server runs apache with nginx as reverse proxy for static files. So nginx already has a
prox_pass set, I set the
ProxyPass in the Apache settings.
ProxyPass / http://localhost:2368/
So the order in which the request go is
nginx > apache > ghost (node). I'm a novice when it comes to server setup and configuration, but the system runs, and I am ok with that. Even if there is a better way.
Getting my data from wordpress to ghost
First I installed the ghost plugin for wordpress (v 0.5.5) on my wordpress (v 4.4.2) and opened the settings page of that plugin. At the bottom there's a button that let's you download your data in json format. This will include the posts as well as the user data which is needed to connect author and post.
There is a tutorial at ghostforbeginners.com explaining how to alter the data so the urls of your images point to the right location. But instead of
I had to use
to match the the folder structure of this current version of wordpress. After going to
ghost/labs I imported the json file. And thats it. All posts and corresponding authors are available.
Migrating my images
Wordpress stores images in folders named
year/month/day/ just as ghost does. So copying all years folders to the
ghost/content/images/ folder is all there is to do. (note: your paths may vary)
cp wp-content/uploads/* ghost/content/images/ -R
If you haven't done so in the past, you may want to optimize your images via optipng or jpgoptim to save some bytes.
Run ghost and make it last forever
So now that I had everything in place I needed a way ghost keeps running even when I close my command line tool. I have chosen forever.
After installing forever starting ghost with
NODE_ENV=production forever start index.js
is all I had to do. The problem is, that each time I upload new or changed theme files I need to stop ghost and restart it again. Quite uncomfortable. I don't know if that's a node thing, or just the way ghost works.
Am I happy with ghost?
Yes I am. Even if there are no plugins at the moment – later apps will come to ghost – it has all I need to blog. Most of the wordpress plugins I used cared about caching. But as ghost generates static files, there is no need for special handling.
The theming is much more intuitive than wordpress. Handlebars is so nice to use in templates. Ok, it might not be as mighty as wordpress hooks and all that stuff, but I can live with that. It's not that bloated with stuff I don't really need. The only thing I am waiting for at the moment, is an app that lets me alter my image paths top point to my cookie less domain.