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.
Sometimes, when you're on a roll, it's hard to stop. What started out as a simple experiment to get static and content assets being served properly out of a multi-site Drupal installation eventually turned in to this rambling and incoherent collection of things mostly because I spend about 2 hours a day on a train with nothing worthwhile to be doing.
In our last adventure we soldered a bunch of stuff onto our little PCB and got it more or less doing what we need, so now the time has come to mount our creations on the truck itself. This actually went a lot quicker and smoother than I’d planned.