Up in the cloud

My last WordPress update to 3.2 couldn’t happen on one of our older shared servers, as it was running earlier versions of PHP and MySQL. I forget which was the culprit, but it meant I wasn’t getting the new lovely interface and other enhancements. I also run about 7–8 personal projects and friends sites off our company servers, which while they’re not big hitters or bandwidth guzzlers, I have been known to take the server offline while “trying something out”.

Therefore I decided to look at finally getting my very own hosting. Can you believe it? 15 years of making websites and I’ve never had my own hosting! I know a few friends use WebFaction, Melbourne Server Hosting and RackSpace, but I wasn’t convinced I’d need anything too big, or expensive. I run a few blogs, we keep all media on services like YouTube and Vimeo and average page impressions hover in the 30-100 a day per site, with exceptions for houseofninja.com and speaknspell.co.uk.

Amazon Web Services

With this in mind, and already having an Amazon AWS S3 account, I did a bit of googlin’ about Amazon’s EC2 cloud hosting. We’ve all heard the phrase “cloud computing”, even my mum has, and it is very much the buzz at the moment. In brief, it’s about providing resizable, scalable, cheap on-demand computing. In my case, about letting me set up a server that operates on an “as used” basis, upping it’s processing power when called upon, pumping out bandwidth when hammered, and I only pay for those occasions.

At the moment on EC2, you can start a micro instance server, and not pay a penny for 12 months in terms of monthly fees. The first 1GB of transfer in and out is also free. Potentially, I get a years worth of hosting for nothing… and even without the free tier, it was working out to $1.08 for the month with 1GB in/out and an elastic IP. Yes, you read that right. one. dollar. eight. cents.

I tried a few instances out, one a Ubuntu instance with WordPress pre-installed, and was going to run one instance for each site… but thought better of that. One micro instance should be able to handle a bunch of sites. Time for more googlin’.

I ended up following this excellent tutorial from Caleb Ogden. Aimed at a mac user, clear, concise, I was up and running in about 30 minutes. There is little point in me re-dressing this for my step-through, just follow it. I have used Ubuntu/Linux a little, and am not afraid of the Terminal, but if you can follow instructions, you shouldn’t have any problems with the tutorial.

When done, you can then follow his walkthrough for configuring Virtual Hosts, so your instance can run multiple sites.

I will add that he doesn’t explain how you get Transmit/Filezilla/Expandrive working with your EC2 instance, due to sftp needing the .pem certificate. This quick reference allowed me in with my usual mac gui tools.

A quick config of my domain’s DNS and boom, this site is now hosted in the cloud.


One thing to note, is that if you intend to let WordPress resize images to your defined media settings, you need to install the GD lib, like so;

# yum install php-gd

Then restart the httpd service.

Oh, and you’ll also need to edit the httpd.conf file (in /etc/httpd/conf) to allow the mod_rewrite rules for permalinks to work. Open the httpd.conf file in Vi, and look for this;

# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
    AllowOverride None

Change None to All, then restart the httpd service again.

If you update to Lion OSX 10.7, you may not be able to connect with Transmit/Expandrive, so you’ll need to add the certicficate again…

ssh-add [yourkey].pem