CDN module without a content delivery network

Modern web browsers put a cap on the number of connections they make to a host. This means if you've got a lot of assets on one hostname the browser will queue the remaining assets, while the ones in front download. This is referred to as blocking.

One way around blocking is to create multiple subdomains, for instance, and to increase the number of resources downloaded in parallel. This is method is called domain sharding and it is recommended by both Google's PageSpeed and Yahoo's YSlow.

I can't exactly afford a high quality CDN like Akamai but I can still leverage some of the benefits and fun of using a CDN. My friend Wim Leers wrote the Drupal CDN module, which you can leverage to do a little home grown sharding of your own.

In my nginx configuration for I added...


Then in my Drupal sites directory I created two new directories for and with a settings file that looks like


I set it up to die(); because I don't actually want to serve my site from those two subdomains.

Boom! Now you just configure the CDN module to use those two subdomains. Just download, install and enable Wim's CDN module. Visit admin/config/development/cdn/details and add something like|.css

And you're set. You may want to tweak your CDN module setup if you serve a lot of image assets.