As I sat here watching Cloud Formation delete the stacks for my two previous iterations of cloudy Drupal, it occurred to me that I've been so busy building cloud Drupals in the clouds I've fallen woefully behind in chronicling my adventures.
So, now we've got our fully formed ghetto CDN running, everything's caching properly, coming from the right host, etc, there's one little problem: We still have just a little bit moar faster we can add, thanks to our favourite CDN. I chose to go with Cloudfront because, so long as you stick to the scrub tier, it's free for a year and, really, I don't ever see it costing that much.
Now that we've got everything set up and our VPS is running a little better, it's time to throw in the last little bit of faster. See, right now, we're still on the hook for serving our content assets. Sure our server's on a good connection, but what could get these tubby beasts out there faster than serving them right out of S3? Exactly.
In tonight's episode, we're going to go over running our ghetto CDN setup using Apache for our dynamic content and Nginx for everything else. This is the setup I use in my live environments partly because all my VPSes have two IPs, partly because Nginx goes like the clappers when it comes to static files.
Now that we've figured out what buckets things belong in and how to serve them, we need to spend a little time teaching our favourite CMS how to take advantage of our new setup. This post is entirely Drupal-specific so if you haven't seen the light or aren't curious about how easy it makes things, you may want to skip ahead to the next in the series, setting up a hybrid Apache+Nginx environment.
Since my dev environment runs Apache and only has 1 public IP, I use it for the entire ghetto CDN setup. This post is going to go over how I set it up and deal with things like CORS and limiting what static and content can and can't do.