in Start

Setup a CDN for Your WordPress Blog [MaxCDN + W3 Total Cache]

It's not too bad!

[This post is part of theĀ Ultimate Guide to Launching a WordPress-Powered Blog series.]

This is a follow-up of a few posts in the above aforementioned series and I wanted to quickly give you an idea of what it might take to install and use a CDN system on your WordPress blog.

For this activity I’ll be walking through the steps of installing and using MaxCDN‘s software in tandem with W3 Total Cache, my favorite WordPress caching system and plugin.

Although this is specifically tailored for those two systems you’ll be able to take the principles and apply them to most other systems as well.

Ready? Here we go…

MaxCDN:

Of course the first thing you’ll want to do is to setup an account with MaxCDN, a CDN provider.

The reason I’ve chosen them is that they are competitive in their pricing, have a great UI, and have provided great support for my needs historically.

Of course, you can use whomever you’d like but I recommend them without reservation.

1. Sign Up and Login

Head over to MaxCDN and get an account. Once you’ve got that figured out then you’ll want to of course login:

2. Creating a New Pull Zone

The next thing you’ll want to do once you see the dashboard is create a new “Pull Zone”. You can do that by clicking the Manage Zones tab in the dashboard:

Next you’ll click the Create a Pull Zone button:

Insert the following information as it relates to your blog:

  • Pull Zone Name
  • Origin Server URL
  • Custom CDN Domain
  • Label
  • Compression [Check Box]

See below:

Just make sure to have these things right as anything wrong will instantly break the CDN’s ability to cache.

Hit the Create button and then wait. It might take a few moments to populate. Once it’s done you can jump into the dashboard which should look something like this:

As you can see my system is being used pretty heavily! Note how many hits to the CDN and cache! This is great since it’s making the load less on the main server when it serves up content. This is a great thing!

Next, go to the Settings tab above and you’ll see the following:

Of course, you’ll want to Test IP once you’ve got it in there! It should validate like so:

This is one of the most important parts as you’ll want to make sure that you put in the right Origin IP Address.

Not sure what this is? You can find this in a number of different ways, the first being simply finding it on your own hosting admin panel – they should give you the IP Address.

Another way is to simply use Terminal on your own computer and “pinging” your domain directly:

[cc]ping www.tentblogger.com[/cc]

It should look like this:

As you can see I’ve found my IP Address! So put that in the right box.

Of course, there are some advanced settings which you can take a look at – some of you might choose to customize this area but most won’t need to touch it.

Perhaps one of the more important options listed above is the HTTP Referrer Protection which can help stop people from stealing your large files and reposting them elsewhere thus sucking down your bandwidth. This, of course, is not a good thing since you are the one that is paying for it! If you find yourself quickly working through your allotted bandwidth at incredible speeds then you’ll want to see who’s “stealing” it and stop it right quick.

3. Setup CNAME DNS Record

The next step is setting up the CNAME Alias in your DNS Zone file for your domain. This is not necessarily required because you can use the temporary domain all you want but it’s highly suggested that you do for consistency of brand and to keep the origin pull URL as short as possible.

I mean, who would want http://tentblogger.mycdn.netdna-cdn.com/post-title/my-image-is-awesome.jpg ? It’s much better if it’s just http://cdn.tentblogger.com which is a lot more clean and professional.

Depending on your hosting solution you’ll find a number of different interfaces to work with. I’ve provided a few different “looks” that you might encounter below:

DYNDNS.com's DNS Zone Manager

MediaTemple's Zone Record Manager

VPS.net DNS Zone Manager

Regardless of what it might look like the step is the same – you want to add a CNAME record with a direct link to your temporary/custom CDN URL.

4. Configure CDN in W3 Total Cache

The final step is quite simple – just add your CDN URL into your W3 Total Cache settings like so and then test it:

Testing the mirror should show a Test passed notifcation like so.

And that’s it!

5. Test It

Of course, you’ll now want to test your blog to see if it’s pulling. One of the best ways to do this is to take a look at any of your posts that has an image file and then open the direct link to that file to see if it’s pulling from the CDN instead:

Here's a post with an image in it.

All I’ll do is right-click and hit the Open Image in New Tab:

Will it work...?

And then the address bar should show a pull from the CDN:

Sweet! It's working!

Of course you can also take a look directly as your CDN URL proper and see if it’s working as well – for example, http://cdn.tentblogger.com should pull up just fine!

And that’s that.

Please let me know if you have any questions or need help at any point! Of course you don’t have to use W3 Total Cache – you can use many other systems as well including WP Super Cache!

Good luck and godspeed!

[This post is part of theĀ Ultimate Guide to Launching a WordPress-Powered Blog series.]