1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

CDN77 Help - Setting up the CDN

Discussion in 'Server Configuration and Hosting' started by speedway, May 14, 2013.

  1. speedway

    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.

    SneakyDave likes this.
  2. Slavik

    Slavik XenForo Moderator Staff Member

    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

    $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 :)
    MattW likes this.
  3. speedway

    speedway Well-Known Member

    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.
  4. speedway

    speedway Well-Known Member

    Oh, and do I still need to add to config PHP the things that Adam Howard outlined in his resource about MaxCDN?
  5. Slavik

    Slavik XenForo Moderator Staff Member

    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.
  6. speedway

    speedway Well-Known Member

    Ah, ok. I'll wait until someone confirms/denys that. Thanks for your help so far though! :)
  7. MattW

    MattW Well-Known Member

    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
    speedway likes this.
  8. speedway

    speedway Well-Known Member

    Brilliant, thanks Matt! Definitely looking forward to hearing from you :whistle:
    MattW likes this.
  9. MattW

    MattW Well-Known Member

    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.PNG

    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.PNG

    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

    $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

    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

    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.
    p4guru, speedway and Slavik like this.
  10. speedway

    speedway Well-Known Member

    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 :)

    MattW likes this.
  11. speedway

    speedway Well-Known Member

    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.
  12. speedway

    speedway Well-Known Member

    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.
  13. MattW

    MattW Well-Known Member

    I don't actually see the CNAME entry resolving to anything

    [nginx@vps2 ~]$ host cdn.ascstatic.com
    Host cdn.ascstatic.com not found: 3(NXDOMAIN)
    This is what mine resolves as
    [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
    speedway likes this.
  14. speedway

    speedway Well-Known Member

    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.png

    I am *REALLY* looking forward to junking WHM when I switch hosts (jumping over the Slavik one day :))
  15. MattW

    MattW Well-Known Member

    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
  16. speedway

    speedway Well-Known Member

    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....
  17. MattW

    MattW Well-Known Member

    Those cnames are working now
    speedway likes this.
  18. speedway

    speedway Well-Known Member

    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.
    MattW likes this.
  19. speedway

    speedway Well-Known Member

    And so they are! :) Only cdn.australianspeedway to come
    MattW likes this.
  20. speedway

    speedway Well-Known Member

    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.....
    Mouth and MattW like this.

Share This Page