2014-09-28, 10:41 AM
MyBB 1.8.0 brings built in CDN compatibility to MyBB for the first time. This feature allows the loading of static files such as javaScript, CSS and images from a CDN of your choice. In this tutorial I will guide you through the basic setup steps.
Note that as of 1.8.0, only the basic “pull” type CDNs are supported. This may change in the future.
Setting up your domains/subdomains
The first step to using a CDN is to set up a subdomain to use. In my case, this subdomain is “s.mybbstuff.com”. All the files for this subdomain live in the following path: “/home/euan/webapps/s_mybbstuff_com/“.
Once you have created this subdomain, you should copy your current static files to it. Below is a list of the folders/files you will need to copy across in a default install:
You should now be able to access your stylesheets from the subdomain you specified earlier, so it’s now time to configure your actual CDN. You should pick a provider that you prefer, but for the purposes of this guide I am using cdn.net. Once you have signed up for an account t with your provider, we need to set up a zone or a package. This is how I have configured mine:
The resource type should be of “pull” type and the origin should be the subdomain we configured earlier (s.mybbstuff.com in my case). You can use any CDN hostname that you desire - most CDN providers will actually give you a subdomain of theirs if you do not wish to configure CNAME DNS records and such. I chose to use cdn.mybbstuff.com just because it looks good.
Setting up MyBB to use the CDN
Now that you have everything configured for the CDN, it’s time to set it up in MyBB. From the Admin Control panel, select Configuration > Settings > Server and Optimization Options. The CDN settings are near the bottom of the page:
Note that as of 1.8.0, only the basic “pull” type CDNs are supported. This may change in the future.
Setting up your domains/subdomains
The first step to using a CDN is to set up a subdomain to use. In my case, this subdomain is “s.mybbstuff.com”. All the files for this subdomain live in the following path: “/home/euan/webapps/s_mybbstuff_com/“.
Once you have created this subdomain, you should copy your current static files to it. Below is a list of the folders/files you will need to copy across in a default install:
- cache/themes/*
- images/*
- uploads/*
- jscripts/*
You should now be able to access your stylesheets from the subdomain you specified earlier, so it’s now time to configure your actual CDN. You should pick a provider that you prefer, but for the purposes of this guide I am using cdn.net. Once you have signed up for an account t with your provider, we need to set up a zone or a package. This is how I have configured mine:
The resource type should be of “pull” type and the origin should be the subdomain we configured earlier (s.mybbstuff.com in my case). You can use any CDN hostname that you desire - most CDN providers will actually give you a subdomain of theirs if you do not wish to configure CNAME DNS records and such. I chose to use cdn.mybbstuff.com just because it looks good.
Setting up MyBB to use the CDN
Now that you have everything configured for the CDN, it’s time to set it up in MyBB. From the Admin Control panel, select Configuration > Settings > Server and Optimization Options. The CDN settings are near the bottom of the page:
- Use a CDN?: Yes
- URL to use for static files: This is the CDN hostname that you configured in step two. In my case, it is http://cdn.mybbstuff.com
- Path to store static files: This is the path to the subdomain that we set up earlier for static files to be stored. All uploads and stylesheets will be saved here from now on. In my case, the path is “/home/euan/webapps/s_mybbstuff_com”