Written by on

Setting up a Content Delivery Network is not that difficult, and it is great to speed up your site. I already provided some tutorials, including a pretty detailed one for MaxCDN. Even in it's simplest forms, it may all still seem a bit complicated, and usually will cost you some. Now recently I played around a bit with CloudFlare. My hosting company Siteground offers a free CloudFlare CDN with all their accounts, which is damn easy to set-up (note that some other hosts offer this solution too). Besides offering speed improvements, CloudFlare also offfers improved security by blocking malicious traffic and spam (actually CloudFlare was primarily built as a security solution), and it can even keep showing your site when your server would be off-line. Let me show you how it works:

There is just one thing to keep in mind: Your site must be accessible as www. Should be no problem, just use my tutorial on how to set this up. Then sign in to your Cpanel account. Then simply look up the CloudFlare button:

You just have to click the Activate free button. You will be asked to provide your email adress. By the way, you can activate multiple sites, so you can also sign in with an existing email address:

After providing your email address, you will be asked whether you want to have the system check if your site is indeed accessible via www or not. I usually make sure it is before activating Cloudflare, but if you didn't, the system can even configure it for you if you click the Yes button:

And that is it! No technical actions required from your side at all.

Note that Siteground now actually performs some DNS changes for you, so it may take some hours before the CDN is fully active. If you're interested, check the Simple DNS Zone Editor from your Cpanel, and you may notice a new CNAME record for CloudFlare, called something like cloudflare-resolve-to.xxxxxxxx.com. Can't be any easier then that, right?

Further configuration and settings

If you click the Manage button now, you can check some of the settings that were set-up for you. Also, some of the settings can be changed by you, though defaults are often fine:

You can indicate how agressive you want your caching to be,  purge cache, finetune some other performance and security settings, etc.

Note that there are also some settings that cannot be managed from here. For these advanced parameters, you simply have to go to the CloudFlare.com site and sign in there with the email you used to register.

Particularly interesting could be the option to set some page-specific rules. Doing so you can set different caching and security options for different sets of pages. You can use wildcards. A logical distinction could be between your user-pages and the pages in the /administrator side. You may check this tutorial for that (discusses Wordpress settings, but should be usefull for Joomla as well). Free Universal SSL is also a nice feature that they offer.

Also the Cloudfare blog regularly publishes articles for more advanced usage, like this one on using subdomains for domain sharing

Joomla specific set-up

On their blog, Cloudflare has a specific article with tips specifically for Joomla. Basically it contains 3 steps that you might want to follow:

  1. Install the CloudFlare Joomla plugin in order to use correct IP's in logging. Note that it is not needed if you are on a host like Siteground or other hosting partners! 
  2. Whitelist frequently used IP's like your office or home that you often use to sign your administrator area. It prevents accidently getting blacklisted.
  3. Create a Page Rule to prevent any caching in your Joomla administrator area. Especially make sure to switch off caching and performance options. You don't want caching whie updating your articles and settings of course. To do so, sign in on the Cloudflare website and go to the Manage Pagerules page. Create a rule for YOUR_SITE.COM/administrator/* and change the settings in red:

 

PRO CloudFlare CDN options

Of course, there is also a paid version of the CDN. It allows for more features, like the SSL-support, use of more then 3 page-specific rules, and performance options like image-optimization, SPDY, etc. Particularly usefull for Joomla could be the activation of the WAF feature, which protects Joomla (and other CMS's like Wordpress and Drupal) for known new vulnerabilities.