Php – How to set up a content delivery network for the site?


I've read up on th ebenefits of a content delivery network and noticed that all sites with growing users would definitely require one. I need to know how can I set it up for my site, as in do I need to restructure my websites code for this matter, who do I need to contact for this etc etc – you know a simple 101 on setting up a content delivery network. I found a few 'plugins' for setting up CDN's on wordpress and Joomla. Is there anything that could be used for a generic solutions?
My application is Php Based, uses the Zend Framework and loads of javascript plugins and includes google maps and image uploads…

Best Solution

If you're using Zend, you should first be restructuring your helpers so that the base url for resources (images, scripts etc) are taken from a config variable.

Make sure all the resources linked in your views/layouts either go through a helper or are prepended with the base url.

For your javascript libraries, I suggest you start pointing them to either Google or Microsoft. Here's the link for the Google JS CDN and here's the Microsoft CDN

Your next step would be to start serving the rest of your resources through a CDN. This depends on your host and your configuration. Amazon, for example has their own CDN so if you're running on EC2 you can use that. Basically look at the options your host offers.

There are lots of CDN options out there with differing options, some free, some not. See this entry on Wikipedia for a list of CDNs that are free/paid/p2p. Also, read the read of the article as a primer.

And something you can start doing immediately :

Setting up coral is not complex at all. You just need to craft your URL to point to their network. If you have already layout/view this is a trivial matter.

Related Question