I‘ve struggled with making my many wordpress blogs fast for the last couple of years. It’s been a pain. Between slow web hosts, crappy themes, and my desire to add tons of plugins, I never thought my blogs would ever be snappy. After going through tons of hosts, I have finally settled on WiredTree’s superior hosting / service (I have a managed VPS). For a theme I narrowed it down to Thesis, which I like love. Then I got a handle on what plugins were necessary as opposed to the ones that just look nice but don’t necessarily help your site load quickly. But even after all of these improvements, my blogs still loaded rather slow. Not terribly slow, but not as snappy as I had seen some sites.
So why can’t my blog be that fast?
I finally did some research as to what may be making my blog slow, and I stumbled across a free Firefox Addon called YSlow. YSlow gives your site a grade on how slow it thinks it is based on a variety of factors. Among the variety of items that piqued my interest, the fact that my site didn’t have a CDN (content delivery network) was the main thing that I figured I was lacking. SO after checking around a bit, I went over to MaxCDN and signed up. Shoot, it’s only $10 bucks for a Terabyte of usage. I don’t totally know how CDN’s work, but from what I can gather, they host all of your site files (or the ones you specify like images, css layouts, and whatever else) and whenever someone hits your site, they somehow provide your content closer to the visitors geographic location. Hence: faster load times.
How to Set up Max CDN on WordPress
1. You’ll need to know how to install plugins on your blog.
2. You will need to be able to edit CNAMES via your web host.
3. umm…that’s pretty much it.
First, you need to download/install the W3 Total Cache Plugin (free). Then sign up for a MaxCDN account. Once your CDN account is set up, you will create a “Pull Zone”. You’ll want to make sure you do the “Custom CDN Domain” which will just be something like cdn.yoursite.com (it doesn’t matter what it is, just make it look pretty & short).
After you create a Pull Zone for your site, MaxCDN will give you a “Temporary URL”.
You’ll take that temporary URL, and add a CNAME to your web host under the domain you are working with. The Host will be the “Custom CDN Domain” that you set up and it will “Point To” the Temporary URL that MaxCDN gave you. Don’t forget to put “.” (without the quotes) after your Temporary URL, and “Custom CDN Name” when you add the CNAME to your web host.
So after you have created the Pull Zone, and added the CNAME to your web hosting, all you have to do is go into your WordPress admin and activate the W3 Total Cache Plugin, and edit some settings. First of all, in the “General Settings tab under the W3 Total Cache plugin, make sure the following settings are set:
- Enable Page Caching and set it to Disk (enhanced)
- Enable Minify and set it to Disk
- Enable Database Caching and set it to Disk
- CDN Type and set to Origin Pull (Mirror) (don’t Enable this yet)
- Save changes
Now move to the “CDN Settings” tab. Under the “Configuration” row, you will see the option to “Replace site’s hostname with:” Here you will put your Custom CDN Domain i.e. the pretty custom domain that you made in your MaxCDN Pull Zone such as: cdn.yoursite.com.
After that, I then scroll down and add my images folder (i.e. /images) to the “Custom File List” field under the “Advanced” row. I do this so that MaxCDN will cache all of my images so they load faster. Not sure if this is smart, as I have noticed a spike in usage in my MaxCDN settings since doing this, but I like it because everything loads super fast. Then save.
The last thing that you need to do to make your CDN work on your blog, is go back to the “General Settings” tab (still in the W3 Total Cache plugin settings), and under the “Content Delivery Network” row, you tick the box to “enable” your CDN. Then “Save Changes”.
After that, you’re all set to go. You will see a notification at the top of the page that says “export your media library”. I did this. Also, I always click the “Empty Page Cache” when it prompts me to as well.
TIP: If you want to make sure your images are cached, right click on one of them, then click “Copy Image URL” then paste it into a browser window and you should see cdn.yoursite.com/images/blabla.gif or something similar to that.
I’m still new to this whole CDN thing, so if you notice something terribly jacked with my site, it would be awesome if you could let me know.