- We have covered what is CDN and how it works in Working with CDN Part – 1. In this article we will see how to configure CDN, CDN providers and etc.
- As we have discussed, CDN caches the static content from the origin server and delivers the content to the user. When a user requests the webpage that is part of CDN server, CDN will redirect the request from origin server to CDN server that is closest to the user’s geographic location and deliver the cached content.
How to Setup CDN?
- The first step in CDN setup is to choose a CDN provider. There are several CDN providers like CloudFlare, Amazon CloudFront, MaxCDN and etc.
- CDN services are both paid and free. It is up to you which service will be suitable to your needs.
- There are several ways to implement CDN in your website like you can choose a CDN provider and configure it between your web host and your CDN provider. Or you can select a web host that provides CDN service default in their configuration.
- Here we will see how to configure a free CDN in Cloudflare. Cloudflare is the most popular free CDN provider. It is a large network of distributed servers which caches the static content and delivers the content.
- When you connect your website to Cloudflare, it will store your files to it’s server which is known as Caching. When a user requests to access your website, Cloudflare responds to that request from it’s server to the closest location of the user.
How to Enable Cloudflare CDN in your website?
To enable Cloudflare CDN, there are two easy ways as below:
- Using the Cloudflare setting option in your host’s control panel.
- Using Cloudflare dashboard
Method-1 Using the Cloudflare setting option in your host’s control panel
- In this method, you can select a specific web host that provides a free Cloudflare CDN option. It is just a single-click setup.
- In your web host control panel, there is an option for Cloudflare setting, you just need to connect to your Cloudflare account and it will process activation of CDN in your website.
- After that you need to configure your CDN settings.
Method-2 Using Cloudflare dashboard
- If your web hosting doesn’t provide Cloudflare CDN setting option, we can go through this method.
- To begin, Sign up to your Cloudflare account, you need to enter email and password to create your account or need to login if it already exists.
- After this, you need to add your site to enable CDN.
- On the next screen you need to choose plans for CDN as per your need and click ‘Confirm Plan’.
- After choosing a plan as per your need, Cloudflare will show you a list of DNS records of your domain and subdomains.
- You need to verify your DNS records and make sure that your domain is active on Cloudflare.
- DNS records which are passed through Cloudflare will be in orange icons and which are not passed through Cloudflare will be in grey icons, they will bypass.
- Once you verify your DNS records you need to click ‘Continue’.
- Next, you need to replace your nameservers to Cloudflare nameservers on your domain registrar account. You need to point them to Cloudflare nameservers.
- Domain registrars typically process nameservers to update within 24 hours. Once it updates, Cloudflare confirms your site activation via email.
- Cloudflare checks whether you have pointed your nameservers to Cloudflare, this process is periodically performed by cloudflare. You can also check by immediate nameserver check, click on ‘Re-check now‘.
- Note: Changing your name servers might take a few moments to reflect on your Cloudflare account. During this time your website might be slow for some users.
- That’s it. After a few minutes your site will be activated on your Cloudflare account. Success message will be displayed on your Cloudflare dashboard.
- You can customize your settings as your need for your website from the Cloudflare dashboard. Some important settings are like SSL/TLS, Page Rules. These settings are also important for your website security and optimization.
- SSL/TLS encryption
- You can configure your website page rules settings.
- This was all about the CDN configurations, you can see all benefits of having CDN to improve your website speed and to deliver content in less time to users at any location.
That’s it. I hope this blog might be helpful to configure CDN in your website and to experience your website faster. Enjoy!! Share your views in the comments section about CDN and help knowing it better… 😊