Joomla Tutorials and Blog Posts

JomCDN Tutorial - Your Joomla Site on Amazon's CDN

Amazon S3 and JoomlaThis tutorial will show you how to host your website site on a CDN (content delivery network).

A CDN solves the problem of hosting your website in only one part of the world:

  • If your server is in the U.S.A., it's going to load much more slowly for visitors from Australia
  • If your server is in Germany, your visitors from India are going to be waiting a long time.

CDNs solve that problem by hosting your content on multiple servers around the world. The client accesses the copy of the data that is nearest to them instead of pulling it directly from your central server. This speeds up load time and eliminates bottlenecks!

jomCDN is a Joomla extension that automatically collects your site's assets (images, Javascript files, CSS files, etc.), synchronizes them with Amazon's servers and relinks all your page content to the Amazon servers. Once it's set up, each person gets your sites file from the Amazon server nearest to them. Wherever your site visitors are in the world, they'll be happy.

Here's how to use jomCDN:

jomCDN Tutorial Video

Download jomCDN

tutuploadsmedia_1290353687485.png

Install a Speed Test

tutuploadsmedia_1290348830995.png

In order to see whether jomCDN speeds up your site, we're going to need an independent test. A good choice is Page Speed from Google. It works with the Firefox browser and the Firebug extension.

tutuploadsmedia_1290354656035.png

When you have Firebug installed, visit the page you want to analyse and click on the small bug icon in the corner of your Firefox screen. That will enable Firebug.

tutuploadsmedia_1290352924083.png

I'm going to analyze http://www.alledia.com where I sometimes write blog posts. I clicked on the Page Speed tab and then clicked on "Analyze Performance".

It produced a score of 82 out of 100 for this site. It also points out some areas in which I could improve the speed of this site.

Let's set up jomCDN and see what the score is afterwards.

Signing up for Amazon S3

tutuploadsmedia_1290349076616.png

Lots of the Joomla files that we have on our site are going to be transferred to Amazon's servers, so we need to set up an account there. Go to http://aws.amazon.com/s3/ and sign up. The hosting is very, very cheap and will likely only cost you a few cents per month.

tutuploadsmedia_1290349179448.png

Once you've signed up, you'll need to do two things.

  1. Go to Account >> Security Credentials and get both a "Access Key ID" and a "Secret Access Key" (screenshot above)
  2. Go to AWS Management Console and click "Create Bucket". Enter a name that you'll remember (screenshots below)
tutuploadsmedia_1290349294957.png

 

tutuploadsmedia_1290353026556.png

Hopefully now you're finished you'll have three details written down:

  • "Access Key ID"
  • "Secret Access Key"
  • The bucket name

Set up Amazon CloudFront

tutuploadsmedia_1290349758552.png

We now need to sign up for a second Amazon service.

  • Amazon S3 is where our files will be stored.
  • Amazon CloudFront is the actual CDN system which we send our files to a server in Australia for our Australian visitors, to a server in Germany for our German visitors and so on.

Go here to sign-up: http://aws.amazon.com/cloudfront/. You will need to use the same account details as you used for Amazon S3.

tutuploadsmedia_1290349848883.png

Once you're logged in to Amazon Cloudfront, click "Create Distribution". The only thing you need to do is choose the bucket name that you created earlier:

tutuploadsmedia_1290356056549.png

When you've saved that, you'll get a row of information about the setup. The one column you need to copy is the "Domain name".

tutuploadsmedia_1290353085787.png

Now that you have that, place it with the information you had earlier. You should have these four pieces of data:

  • "Access Key ID"
  • "Secret Access Key"
  • The bucket name
  • The domain name

Install and Configure jomCDN

tutuploadsmedia_1290356235054.png
  • Go to your Joomla site and install the jomCDN plugin.
  • Go to Extensions >> Plugin Manager and open it up. Here you'll need to enter those four pieces of information we collected earlier.
  • Enable the plugin and click Apply

There's one final task to do now. We need to set up a cron job. That will allow us to regularly update the file on Amazon's servers.

Inside the plugin, scroll down to the "Complete setup" field. There will be a URL for the cron job with the format htttp://yourdomain.com/?cdn_run_cron.

A note: if you're using Shell access, the URL will be different. Please read the JomCDN instructions for further details.

tutuploadsmedia_1290356351250.png

Click that link and you should see a list of all the Joomla files being added to Amazon's servers:

tutuploadsmedia_1290356453821.png

If you don't see this message, its likely that another plugin is blocking it from working. To fix the problem, go to Extensions >> Plugin Manager and disable the plugins one-by-one until the cron job works. The most likely culprits are other compression / speed plugins that you'll find in the Plugin Manager under the "System" category.

Note: once the cron job link is working successfully, go to the "Advanced Parameters" tab inside the Extensions >> Plugin Manager >> jomCDN and change the "Cron Job URL Parameter" part of the URL to something else. As Alejandro notes in the commnets below, it's not safe for other people to know this URL.

Now you have a secret, successful URL, you're ready to set up the cron job. Each host is likely to be different, but our host Rochen.com uses CPanel, a very popular hosting control panel.

Login to the hosting account and click on "Cron Jobs":

tutuploadsmedia_1290350415536.png

Choose a frequency for your cron job (once a day is a good choice, enter the URL of your cron job into the "Command' link and click "Add New Cron Job"

tutuploadsmedia_1290353155984.png

Test Your Setup

tutuploadsmedia_1290353186676.png

Now that my setup is complete, I'm going to use Page Speed once more to test the site's speed. This time it gives a result of 89/100 with far less important errors.

I've still work to do on speeding up the site, but jomCDN has helped by nearly 10 points out of 100.

Comments

 
Alejandro
#1 Alejandro 2010-11-21 20:37

I also got an almost 10 point improvement in page speed score on my site. I suggest you change the cron url var to something else using the setting in the jomCDN plugin. Going to the url you have in your image lets me see the output of jomCDN, including absolute file paths and warnings (shouldn't you disable error reporting on your server as well?), and could be used maliciously to create additional load on your site.
 
 
kl6H_steve
#2 kl6H_steve 2010-11-21 20:46

Thanks Alejandro - that's a good catch. I'll include a note in the tutorial asking people to change the cron URL.
 
 
xtopher66
#3 xtopher66 2010-11-30 03:56

Huh............ .can you explain
"Note: once the cron job link is working successfully, go to the "Advanced Parameters" tab inside the Extensions >> Plugin Manager >> jomCDN and change the "Cron Job URL Parameter" part of the URL to something else. As Alejandro notes in the commnets below, it's not safe for other people to know this URL"

Isnt that url important? Why change it?

Can you explain the whys and hows? What do you suggest to change it to?

Great article anyway and useful website.
 
 
kl6H_steve
#4 kl6H_steve 2010-11-30 11:28

Hi xtopher66

Yes, the URL is still important. If you change it, it will still work.

The important part is that it's secret and other people can't guess what it is.
 
 
Kevin Meinert
#5 Kevin Meinert 2010-12-07 20:39

Nice tutorial on getting your Joomla site working with a CDN. I'd like to mention that the plugins and Joomla sites work well on other CDN's as well. Our Joomla CDN, www.maxcdn.com/.../joomla-cdn is cost-effective, and implements very easily with Joomla websites.

Feel free to contact me directly if you have any questions.
 
 
xtopher66
#6 xtopher66 2011-01-08 14:24

Quoting steve:
Hi xtopher66

Yes, the URL is still important. If you change it, it will still work.

The important part is that it's secret and other people can't guess what it is.


From what I can see EVERY cron url is the domain+?cdn_run _cron. So I can guess quite easily what this is!

Even if I change the parameter the cron url still remains the same.........an d I can guess that for every site cant I!

So whats the point of changing it if its easily second guessed?
 
 
Andy Poorman
#7 Andy Poorman 2011-03-15 13:55

Steve,

Great tutorial and thanks for your interest in our products! There is one small mistake though:

In the image, ostraining.com/.../..., the "Command" field only has a URL in it but the URL should actually be passed as an argument to a program that can access it such as wget or curl like this:

wget -N www.alledia.com/?cdn_run_cron

Thanks again!
-Andy
 
 
bpw
#8 bpw 2012-07-19 04:37

I've found gtmetrix.com/ to be a nice alternative to downloading and installing PageSpeed and Yslow and using Firefox and Firebug.
 

Add comment


Security code
Refresh

blog-ad

Start Online Training

Members get access to all our video training. That's 1,141 training sessions in Joomla, Drupal, WordPress and Coding.

Manage All Your Joomla Sites

adminicredible

With Admincredible you can update and manage all your Joomla sites. If you have 5 or 500 sites, Admincredible will make your life easier! Visit Admincredible.com.

Latest Comments

The License for Our Tutorials

All of our tutorials are published under the Creative Commons Attribution-NonCommercial license. This means:

  • You can re-use these tutorials.
  • You can modify these tutorials.
  • You must link back to our original tutorial.
  • You can't use these tutorials commercially.

Click here to read the full license.

Open Source Training is not affiliated with or endorsed by the Joomla, WordPress or Drupal projects.
All product names and trademarks are the property of their respective owners.

Copyright 2013 Open Source Training, LLC. All rights reserved.