How to Setup a CDN to Your Joomla Website?

There is an interesting reason why pages load quicker on large sites. Sure, they have good servers, but they also use a globally distributed network called Content Delivery Network. In the rest of this article, we are going to talk about what a CDN actually is, how it works and how to add one to a Joomla website.

So, what is a CDN exactly?

A Content Delivery Network (CDN) consists of a bunch of servers located in many places widely around the world, and their main purpose is to serve Javascript, images, CSS and stuff like that to the visitors of a particular site.  The reason why is it so clever is that each user downloads the data from the closest server location in the CDN. Therefore the websites load faster simply by reducing the physical distance between the downloader and the files.

There are various CDNs available. Some of them are only for static files and images, other types are for video and audio. With a Push CDN, you need to start the file transfer or otherwise it won’t happen. There is another type called Pull CDN, which doesn’t need any initiation to copy the files from the web server. You can make your web pages load quicker with solutions like these, and actually some of them are for free.

Pros:

  • The pages load quicker, resulting in a better user experience
  • Server bandwidth is reduced
  • Server load is also reduced

Cons:

  • Website setup becomes more complex
  • It can cause viewing errors for your users if not configured accurately

Let’s learn more about CDN

For example, we are going to take a look at the process of requesting and displaying a website on a browser. Let’s see what happens with, and without using a CDN.

First, let’s assume:

  • The end point (the user) is requesting from Germany
  • The requested server is in Texas
  • There is a CDN location near the user in France

A typical non-CDN website:

  1. The browser straight off connects to the server in Texas and asks for the HTML
  2. The server sends it back from Texas to the browser
  3. The browser asks the Texas web server again for images, Javascript and CSS
  4. The server sends the images, Javascript and CSS to the browser

Now a website with CDN:

  1. After connecting, the browser requests the HTML from the server in Texas
  2. The browser receives the HTML from Texas
  3. The browser is now informed that the images, Javascript and CSS are in French, so asks them there
  4. The images, Javascript and CSS are being sent by the French CDN

As you can see, the distance travelled by the data is much shorter using this CDN/web site combination, therefore it takes less time to load and display the pages.

This is how you add a CDN to Joomla

We already mentioned the two main CDN types for static content, which were Push and Pull CDNs. Both of them have their advantages depending on the setup of your website. The Pull CDN is the one which is great for most of the Joomla sites and there is not much initial setup and maintenance needed. We will introduce you to the Pull CDN in this article.

Start with choosing a CDN provider and create an account with them. Now establish the DNS redirects while reading the instructions given by the provider. Once the cdn.yourdomain.com points at your CDN account, it’s all good.

The next step after the DNS and the CDN account configuration is to copy your images to cdn.mydomain.com from www.mydomain.com. You can do it by changing all image URLs manually, but that’s very inefficient since it takes a lot of time to do that. Save your time instead and choose the Joomla CDN plugin for that purpose.

If you want the links of your images, Javascript and CSS to be automatically changed, definitely choose a Joomla CDN plugin. Some of them include the option to specify the file types which should be rewritten while allowing the use of multiple CDNs at once. You can also easily turn the CDN on and off by using a plugin like this.

The Joomla CDN plugins can be found in the Joomla Extensions Directory, just go to Core Enhancements >Performance >Content Networking category.

CDN Plugin Roundup

We made a short list for you about the three Joomla CDN plugins we have found most useful. Let’s see the pros and cons of each one.

CDN for Joomla by Regular Labs

joomla cdn regular labs

http://extensions.joomla.org/extension/cdn-for-joomla

This is a great option and works on Joomla 2.5, 3.5 and with other big CDN providers. Thanks to its developer, the Regular Labs team, there are lots of excellent Joomla extensions available. They actually created 25% of the top extensions. You can install it without any complications and it works with Pull CDN which is significantly easier to work with. This Joomla plugin integrates with a wide range of CDN providers, such as MaxCDNAmazon CloudFront, CDN77, CDNetworks, CDNify, CacheFly, EdgeCast Networks, KeyCDN and probably others too.

The paid version is 30 Euro, but it’s also available for free. The difference between the two is that if you pay, you get a version with more support and the option to add multiple CDN. These are not entirely necessary, but they can help a lot.

The main reason we chose CDN for Joomla is because it’s simple, flexible and stabile. You can simply exclude any files that might cause a problem. It works very well with many of the Joomla sites with easy installation and configuration. When there is a cache issue, you can simply turn it off and then back on if it’s necessary. And at last but not least, this is the only plugin on the list which is available for free.

CorePHP’s JomCDN

jomcdn site accelator corephp

http://extensions.joomla.org/extension/jomcdn

The developer of JomCDN is Rafael Corral and it’s compatible with Joomla 2.5, 3.0 and it’s also running with Rackspace CloudFiles and Amazon CloudFront. It’s not free though, so you have to pay 29.95 bucks to get the full version with the features. The documentation and the installation are both very straightforward so it seems that they have really put in some effort.

By using this plugin, you will have complete control over the cache and the files transferred to the CDN. It works with Push CDNs, and the features include the excellent handling of file copying and URL rewriting too. Although it’s mostly better to use a Pull CDNs because of the automatic file transfer, that shouldn’t stop you from using JomCDN. They did an amazing job with solving this problem.

JomCDN is the best choice for Rackspace and Amazon users. It’s very user friendly and comes with quite a few features. The instructions are easy to understand and it absolutely works well.

JoomlArt’s JA Amazon S3 CDN

joomlart google s3 amazon cdn

https://www.joomlart.com/joomla/extensions/ja-amazon-s3

Now this is one of the most experienced Joomla providers with over 10 years in the business. The JA Amazon S3 brings you the power of cloud computing. It’s very useful because while uploading the files, it also updates the file location at the same time. So once your images and files are uploaded to the servers of Amazon S3, this plugin updates their destination path when someone wants to reach the files. Therefore the files won’t be requested from the site folders, but the Amazon S3 instead.

The price of this plugin is 35 bucks, but they have a really simple web services interface with many useful features. They provide a CloudFront & CDN Support which is a delivery system for your static and streaming content, using more than 16 locations. The requests are immediately connected to the nearest location, guaranteeing an excellent performance.

You can also manage your files easily whenever you want. The modifications can be done by using multiple Amazon S3 accounts. You’re free to create numerous accounts for all of your administrators. The visibility of your files also can be limited with the File & Folder ACL system.

A few additional things

Of course, attaching your website to a CDN makes it more complex. One thing you must remember is that your images, Javascript and CSS are not coming from your web server, but from the CDN instead.

Therefore it may happen that the changes won’t appear when you update your site. It’s because the CDN is on, so don’t forget to temporarily turn it off as long as you do stuff like that. By doing so, you can remove the complications altogether. Just make sure that you turn it back on every time the update is finished.

However, you can also log in to the control panel and get rid of the unwanted cache in the CDN. Then your files will be freshly copied there, thus they will appear in the browser.

Thank you for reading

We hope you learned something useful about the Content Delivery Network throughout this article. It needs additional configuration and a little bit of experience to use a CDN properly, but it’s definitely worth it for the sake of your website. Not to mention if you have users from all around the world, then it’s even more important.

Please share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Join the Discussion!

Your email address will not be published. Required fields are marked *