Hello and welcome to this article about linking your WordPress website to a content delivery network. If you have stumbled upon this post from Gawd knows where, you may be interested to know that this is from a series of articles from a Kindle eBook called, “How to Set Up a WordPress Website from Scratch.” If you would prefer to buy the book to make life easier, feel free to download it by clicking the image below.
Right, we’re getting close to the end of this training series. I hope you have found it useful so far. I also sincerely hope you are following the instructions and seeing your own website grow. There’s nothing better than finding out that something you thought was so complex is actually surprisingly easy.
Now, for this chapter, we’re going to look at something called Content Delivery Networks (CDN). You’re going to discover:
– What Content Delivery Networks are
– How we connect a website to a CDN
– How we check that we got everything right
There are many CDNs that you can use and you can also spend quite a lot of money if you want. However, the way I do this is not only easy but free! Here’s the video if you would like to see what I do here.
What Are Content Delivery Networks?
I’m going to cheat a little bit here and use Cloudflare’s explanation of CDNs to er… explain what CDNs are. However, as I’m also recommending Cloudflare as the website for your CDN, I’m hoping that they won’t mind too much. So, here is Cloudflare’s definition:
If you’re saying, “What the heck did all that mean?” don’t worry. I bet you 99% of people who create websites say the same thing. However, understanding what a CDN does is not really necessary. All you have to accept is that if you run your site through a CDN, Google not only loves your site more but will also rank it higher.
How to Connect a Website to a CDN?
So, what I’m going to do now is to explain to you what you should do. Obviously, you may feel that you want more information about CDNs before you proceed, and that is absolutely fine. I did quite a bit of research myself but then I didn’t have anyone to tell me about CDNs or Cloudflare. Feel free to do some googling and then come back here when you are ready to proceed.
So, the first thing you need to do is go to Cloudflare and register for an account. Once you have done that, you should find yourself on your homepage where you can click a blue button which says ‘Add a Site’. Or you may be on a page inviting you to add your first website. Sorry, I can’t remember exactly which. Either way, I’m sure you can work out what to do.
Either way, add your domain into the little box you will be able to see. By the way, you do not need the ‘https://’ bit. Only put in your domain name (yoursite.com) and then click the blue ‘Add Site’ button below the box. Next, you’ll be taken to a page with a few different offers on it. When your site becomes hugely famous, paying for a CDN will definitely be worth it. Until then, just take the free option. Once you click ‘Confirm Plan’, your site will be scanned and then you’ll be presented with lots of information. You may also see something like this:
How to Add Records in Cloudflare
If Cloudflare is giving you a message similar to the one in the image above, you’ll need to change a few things. First of all, make sure that you are in the DNS settings as below:
Click the button where it says ‘+ Add record’ and you will get the following:
Where it says ‘Type’, you need to click the arrow and select the one you need, which will be ‘A’, ‘CNAME’ or ‘MX’. If you’re not sure, look at the message where it says DNS Management. You will see what type of record you need to add there.
For ‘Name’, you need to add @ whether you are adding an ‘A’, ‘CNAME’ or ‘MX’ record. So, no matter what sort of record you are adding, you put @ in the ‘Name’ box. Moving on to what type of record you are adding, whether ‘A’, ‘CNAME’ or ‘MX’, the box next to ‘Name’ will change.
You get ‘IPv4 address’ if you are adding an ‘A’ record. If you are adding a ‘CNAME’ record, you will see ‘Target’. Finally, if you are adding an ‘MX’ record, you will see ‘Mail server’. Here’s what you need to type in the box depending on what you are doing.
– IPv4 address = 188.8.131.52
– Target = youdomain.com
– Mail server = mail.yourdomain.com
One thing that you need to make sure is that there are no conflicts. For example, if you are adding an ‘MX’ record, make sure you delete all the other MX records first.
Using Namecheap Support
Finally, if you think that something is not working, for example, you are not receiving emails, and you do not feel confident to change things, you can always contact Namecheap chat and ask for help. They are great and they have never failed to help me when I have needed it. And don’t worry about sounding stupid. Trust me, I am sure that whatever questions you ask, I have asked stupider ones.
When you have finished, scroll down to the bottom of the page and click ‘Continue’. Now, you will have to change the nameservers so that your CDN will work. Now, don’t panic here. This is easy stuff. Login to Namecheap, navigate to your dashboard and click on the ‘Manage’ button that is on the right of your domain name. You’ll get taken to a new page which has the following:
– Status and Validity
– Redirect Domain
Scroll down to the nameservers and click on the little arrow where it says Namecheap Web Hosting DNS’. Now, click on the ‘Custom DNS’ option and you will see two fields that you need to fill in. Here’s what you need to put in the top field and bottom field respectively:
Nameserver 1 – chad.ns.cloudflare.com
Nameserver 2 – robin.ns.cloudflare.com
Once you are sure you have got this right, click on the green tick mark to the right of your new nameservers. If you have got it right, you will see that at the top of the page it says, “DNS server update may take up to 48 hours to take effect”.
Go back to Cloudflare and click on the blue button that says, ‘Done, check nameservers’. You will get a message that says something about the system is sorting itself out and come back later to check.
How to Check Everything Is Working?
And that’s all you need to do. If you want to see your CDN at work, the easiest thing to do is to go to GTMetrix and run a test on your site. Click on the YSlow tab and find ‘Use a Content Delivery Network’. If it has a bright green bar next to it with A(100), you have successfully sorted out a CDN for your website. If it doesn’t wait a while and check again; the changes you have done above do not necessarily show up immediately.
Wrapping Everything Up
And there you have it. In this article, we learned how to link a website to a Content Delivery Network and what a Content Delivery Network is. Of course, I am using the word ‘learn’ in its loosest possible sense as we really did no more than scrape the surface of what a Content Delivery Network is and what it does.
We also learned how to add a website to Cloudflare and how to change nameservers in Namecheap. That’s actually quite a useful thing to know in the future, so well done for doing that. After adding your site, you learned how to check whether your site has been successfully connected to a CDN.
And that’s all we need to do here. In the next article, we’re going to look at how to make your website compliant vis-a-vis GDPR.