Using Multisite with a CDN?

I’m running WordPress Multisite hosted with Bluehost, and only have 5 low volume sites. My site load time has been awful recently, so I’ve used Lazy Load, DB optimization, Smush.it, and Quick Cache to try to remedy the speed issue.

Spending a lot of time looking for a good CDN, and apparently, there ISN’T a CDN that easily implements with WP Multisite. Every one requires W3 Total Cache, which can’t be activated across the network. There are risky-looking tutorials on how to create a mirror static page, etc., but nothing that makes a clear and simple installation.

My choice CDN would be MaxCDN, but even they require W3TC.

Does anyone have a definitive answer on how to put a Multisite installation in the cloud, or on a CDN service?

2 Answers
2

The easiest way to go would be to use an “Origin Pull” CDN. These sorts of delivery networks pull media directly from your site, cache it (usually for the TTL defined by your Cache related HTTP headers).

Any origin pull CDN will work fine with multi-site. You rewrite all static resource URLs in your content to the CDN, when the page loads, the resources are requested from the CDN. If the CDN does not have them, it goes and grabs them from your server, stores them, then serves them up.

I use Amazon CloudFront for this — It’s not free, but lasts month 430,000 and 3 GB of transfer cost roughly 80 cents.

The difficult part is just rewriting the static resource URLs in your pages to the CDN, which you can do fairly easily with output buffering and regex magic. Here’s an example I wrote and am using on several client sites — it was inspired by Mark Jaquith’s CDN plugin. Both of these should work fine with multisite, or you can roll your own — you should! its fun!

One caveat, I suppose, is that your server has to be configured correctly and send reasonable Cache related headers (Cache-Control, Expires, etc). ms-files.php is turned off WordPress 3.5 by default, and it sent some cache headers. Some origin pull CDNs will let you set custom expiration rules that ignore HTTP headers of the origin, however.

Leave a Comment