Create static HTML pages from a local Wordpress installation
Wordpress is convenient when setting up a little web site / blog. You might even think about self-hosting instead of using the services from wordpress.com.
Doing so is easy, but also eats up resources on your system and even worse, opens the door of security holes. You need to think about a lot of things like file permissions, database access, web server config, the PHP subsystem. And of course Wordpress itself. So you need to update often. Over and over again.
If you are like me, then you don't. But always feel bad and that you should do something about it.
If you depend on many Wordpress plugins, then move on. This isn't for you. But if not, then why not setting up a local installation and simply fetch the static HTML pages generated by Wordpress and deploy them on a brain-dead simple static HTTP server?
Of course with this you remove all the dynamics of your system. I think comments could easily moved to an external service like disqus.com. And as I don't really like all these fancy widget changing content automatically all over, I see this purification as another advantage.
To jump-start your local installation, the wonders of virtualization came in handy for me. Among others TurnKey Linux provided a recent version of Wordpress running on a stripped down Linux. Deploying this to a virtual machine of your choice, migrating your old data from the live Wordpress over to the Turnkey installation is all you need.
Afterwards you can work completely locally on your Wordpress content and setup. Then simply invoke a script similar to the one below to automatize the update of your production system. And voila, you have a static mirror of your Wordpress content for free.
As a nice benefit you already get a local backup of your content in your virtual machine.
#!/bin/bash
# mirrors and uploads a wordpress blog to a static web site
# check http://x-ian.net for details
# my configs
LOCAL_WORDPRESS=192.168.6.129
REMOTE_WORDPRESS=x-ian.net SSH_LOGIN=<your ssh credentials>
REMOTE_HTTP_DIR=x-ian.net
# preparation
cd /tmp rm -rf wordpress_mirror
mkdir wordpress_mirror
cd wordpress_mirror
# mirror of whole wordpress installation in static html pages
wget --mirror -R xmlrpc.php,trackback http://$LOCAL_WORDPRESS
# replace remaining links with real server
find ./$LOCAL_WORDPRESS -type f -exec sed -i "" "s/`echo $LOCAL_WORDPRESS`/`echo $REMOTE_WORDPRESS`/g" {} ;
# upload static html pages
cd $LOCAL_WORDPRESS
tar czf ../wordpress_mirror.tgz .
scp ../wordpress_mirror.tgz $SSH_LOGIN: ssh $SSH_LOGIN "rm -rf x-ian.net; mkdir x-ian.net; cd x-ian.net; tar xzf ../wordpress_mirror.tgz"
# cleanup
rm -rf /tmp/wordpress_mirror*
ssh $SSH_LOGIN "rm wordpress_mirror.tgz"