hey thanks for the info
actually i've setup cdn with my wordpress site by using W3 total cache and it's easy because there's an option there to choose Amazon CloudFront with a click of a button after I've setup my "origin pull"
So in this case after i've setup cloudfront pull how do I configure my xenforo?
Ok - so you created a domain pull account at Amazon Cloudfront.
The origin in your "Distribution" has to be your domain name your Xenforo is located (you can't specify folders yet)
*NOTE - creating CNAMES for your CDN is not essential. You can use your cloudfront domain name instead. It should still work ok (maybe some adblockers on some browsers wont like it??? Not sure) It will just look like you are pulling from cloudfront when someone views your page source eg e445rrt5wadw.cloudfront.net instead of your domain name. If you choose to do this, just skip the adding CNAME part and replace all references to CNAMEs below with your cloudfront domain name.**
Select the distribution and select edit.
Under cnames, I entered the following (you can create whatever names you want) :
cdn-js.mydomain.com
cdn-data.mydomain.com
cdn-img.mydomain.com
Then you have to go to your website hosting panel/dns zone editor and create those CNAMES.
The CNAME is cdn-js (Some web servers require the full cdn-js.yourdomain.com - best to check with your host or in your hosting panel) and the target address is the Domain Name in the AWS Dashboard (will look like e445rrt5wadw.cloudfront.net - some web hosting systems require a "." after the end of the target address so you may need to put that in. )
Do the same as above again and create the other two CNAMES cdn-data and cdn-img pointing to the same Domain Name as above (looks like e445rrt5wadw.cloudfront.net- get yours from your AWS Dashboard)
Now it's time to tell your Xenforo about the CDN and where to get the images from.
Edit /library/config.php
Add the following two lines (they aren't already there)
Code:
$config['externalDataUrl'] = 'http://cdn-data.yourdomain.com/forumfolder/data';
$config['javaScriptUrl'] = 'http://cdn-js.yourdomain.com/forumfolder/js';
NOTE - If your forum is in root, just remove the forumfolder part and leave it as '
http://cdn-data.yourdomain.com/data' '
http://cdn-js.yourdomain.com/js'
Save config.php and reupload it.
You can now test your site by visiting the page. If it's loading ok, you can check that its working by viewing Page Source. Look for references to the cdn names cdn-js and cdn-data - if you can them in the page source it means your files are being loaded from the CDN and we can move on to the next part which is adding your image CDN path.
Go to Xenforo Admin Control Panel. Styles -> Style Properties -> General. Look for path to images. Change this to
http://cdn-img.yourdomain.com/forumfolder/styles/default (or whatever the path is to your styles folder you are using - if you are using the default then what i've given is correct)
Save that and confirm that images are loading on your forum. If yes, check the page source and look for references to cdn-img.yourdomain.com. If you can see that - congratulations! You're done.
This is all theory as I haven't actually used cloudfront. I use MaxCDN with Apache on my server and it works fine. They are both setup pretty similarly (except you can specify folder paths on MaxCDN) so I see no reason why it wouldn't work.
Cheers
Graham