Off-site assets with S3

Finally, i’ve got round to moving the /misc folder off onto Amazon S3. I’ve decided to do this due to my upcoming hosting move, not having to worry about several hundred megabytes of static data will ease the strain of moving. So, how have I done it?

First of all I created a bucket on S3 with the name assets.nikdoof.net, from there I setup a CNAME in BIND for assets.nikdoof.net pointing to s3.amazonaws.com to allow direct referencing to the files within the bucket.

assets.nikdoof.net.     IN      CNAME   s3.amazonaws.com.

Then for the relocation of the misc folder, setup a simple Apache mod_rewrite rule to transfer all requests for the misc folder to S3.

RewriteEngine on
RewriteRule ^/misc/(.*)$ http://assets.nikdoof.net/$1 [R,L]

So now it’s all up and working, and to give it a try yourself, here is a fetching wallpaper of Rachel Stevens.


139 Words

2008-03-08 00:00 +0000