CDN77 Help - Setting up the CDN

speedway

Well-known member
I have done it, I have activated my 14 day trial of cdn77.com. Now I just need a little help getting things right.

Currently I serve some images and smilies from my static cookieless domain, all others including attachments, avatars and style images are served from my site root. So, where am I putting my cdn address (now setup as a cname off my domain name) for a) my style, and b) everything else.

I am a total noob when it come to cdn's, please be gentle.

Cheers
 
XenForo CDN support works with some template trickery.

The CNAME is added just to make the URL's look nice.

Otherwise, you set up your CDN ad per the instructions from your CDN provider.

Edit the config.php to add

Code:
$config['externalDataUrl'] = 'http://yourcdnaddress.yourdomain.com/data';

And save.

Now, whenever a template is rendered via XenForo, items normally in the data folder will be appended to add the CDN URL instead.

If the item is in the CDN, it is served, if not, then the CDN goes directly to your site to pull the data and store it.

Job done :)
 
Fantastic, thanks Slavik.

just to reiterate, everything under the data directory would get pulled into the CDN? So if I move the images and smilies from my static domain into the data directory it should work...

I'll do this later when my forum slows down, especially the CDN grabbing and transferring bit.
 
Oh, and do I still need to add to config PHP the things that Adam Howard outlined in his resource about MaxCDN?
 
I don't think simply moving things to the data dir does that, I think only specific items which are "expected" to be there get appended in the template rewrite.

Mike probably knows best.
 
Fantastic, thanks Slavik.

just to reiterate, everything under the data directory would get pulled into the CDN? So if I move the images and smilies from my static domain into the data directory it should work...

I'll do this later when my forum slows down, especially the CDN grabbing and transferring bit.
You can set up multiple CDNs with them. I have a few cname entries all pointing to the main site, so js and data are served from the CDN.

My smilies and static images are still served from a different domain that is behind the CDN. I'm on my iPad the minute, but can show what settings I used later when I'm on my PC
 
Here is what I did.

Main website: www.z22se.co.uk
Cookieless domain: z22se.com

If you want your attachments to also be served via the CDN, have a look at [Tinhte] Image Attachment Optimization & CDN Support . This will allow you to specify the CDN URL to allow your attachments to be served via CDN77.com. If you also use XenMediaGallery or Showcase (or both), and want to serve all your attachments via the CDN, you will need xfrocks [bd] Attachment Store

I currently have my smilies, node icons, and XF style images hosted on a separate domain called cdn.z22se.co.uk. This is separate hosting to my main site.

The below will allow you to have your main site, and extra images served via the CDN.

So, for the cdn.z22se.co.uk domain which is serving the style and node icons, in CDN77.com, I created a CDN with the Original Website as cdn.z22se.co.uk, and then created the cname entry in my DNS to point to the specific domain name they gave for that CDN instance. I used my other domain name z22se.com and created a cname cdn.z22se.com

In the XF ACP, set the style properties for the default image path to the new CDN name

style properties.webp

This will then point anything using the @imagePath to the CDN domain

For the rest of the main site, serving the data and js folder from the CDN.

I created another CDN entry, and added a couple of extra cnames to use
main cdn.webp

Going to any of the cnames will take you to the main site.
To specifically serve the js folder and data folder via them, in your config.php file, you need to specific the URL to use

EG:
PHP:
$config['javaScriptUrl'] = 'http://cdn-js.z22se.com/js';
$config['externalDataUrl'] = 'http://cdn-data.z22se.com/data';

Now, if you have xfrocks add-on installed, that will also now serve ALL your attachments if you specify to use External Data Directory
xfrocks.webp

I have over 11GB being served now via this!

The Tinhte add-on can set the CDN to simply overwrite the URL used for your attachments to send them via the CDN
tinhte.webp

I've set this up now on my own site and another site I help administer, and it's working great.

Hope this helps, anything else, just shout up.
 
Brilliant! Thanks Matt, what an excellent resource. I have 2 domains serving the site, my main one at australianspeedway.com and another one, ascstatic.com, that is split into 3 sub domains - i (images), j (javascript) and c (css). While I am not using all of those on this forum, I did use them on my VB forum to allow cookieless connections in an attempt to get more connections per browser sessiion thereby speeding things up. The downside of all this was, of course, that they were all being served from the same location, namely the east coast of the US where my site is hosted. None of this was especially good for an Australian based site.

With that rant over, I am hoping to speed things up dramatically via the CDN.

I shall return if I run into any problems :)

Cheers
 
Me again :)

I have setup the cdn @cdn77 to cdn.ascstatic.com and created the CNAME at my server pointing to the cdn77 cdn name as instructed. I then went into my style and replace styles/core with http://cdn.ascstatic.com.

When I refreshed the site all images were gone. Ok I thought, the cdn needs time to grab them. Waited 15 minutes or so and refreshed again but still no style images. What am I am doing wrong? Will the cdn77 cdn grab what it needs or do I need to put them somewhere?

Sorry for the noob questions, first time doing this stuff.
 
I *think* I know. The cname created at your server for your .com, did you create the cname there point to the co.uk address? ie. cdn2.z22se.com -> z22se.co.uk which has a cdn name created at it for the cdn77 server.
 
I don't actually see the CNAME entry resolving to anything

Code:
[nginx@vps2 ~]$ host cdn.ascstatic.com
Host cdn.ascstatic.com not found: 3(NXDOMAIN)

This is what mine resolves as
Code:
[nginx@vps2 ~]$ host cdn-data.z22se.com
cdn-data.z22se.com is an alias for 490090824.r.cdn77.net.
490090824.r.cdn77.net has address 77.243.179.43

cname.webp
 
That triggered me to look at WHM.... and I hate WHM. cdn-j, cdn-d & cdn2 now resolve to cdn77, cdn however is refusing to do anything even though it is setup the same.

Screen shot 2013-05-15 at 12.48.55 AM.webp

I am *REALLY* looking forward to junking WHM when I switch hosts (jumping over the Slavik one day :))
 
I use WHM, but I use DNSMadeEasy for my DNS.

Those look right, it might just take a few hours to propagate out. You can always use the cdn77 domain name to test with initially until your cnames are ready
 
Yes, 'tis strange. The 3 I mentioned propagated real quick, inside 5 minutes. cdn.ascstatic and cdn.asustralianspeedway STILL haven't come to light.

Might look into a third party DNS service myself, will make my move easier when I do it....
 
Okie dokie.... the first bit seems to work. I used cdn2.ascstatic.com in the styles General properties but had to adjust that to http://cdn2.ascstatic/styles/core to get it to work. I have Europe, US and Australia POPs selected @ cdn77.

Thanks you Matt for persevering with me, I do appreciate it. If you are ever in Sydney I'll buy you a beer :)

To be honest, on my home connection, it doesn't seem any faster than it was. Probably has to do with our crappy internet down here.
 
Wow, just did the data and js dir's. Things are starting to happen now! Got to go buy xfrocks addon to complete the deal and then sit back and see how it all pans out over the next 14 days.....
 
Top Bottom