CloudFlare Free content delivery network speed up website

What is Content Delivery Network CDN?

Lets understand this concept with an example.You own a website.You may be using shared hosting or VPS (Virtual Private Server) or dedicated server.In all of above cases website is hosted on a server.The server is located somewhere in the world (for example New Delhi in India or New York in US).Content Delivery Network (CDN) is a collection of servers across the globe.

Some famous content delivery networks are CloudFlare,MaxCDN,Akamai etc.It is used to serve your static files like images,video and other static resources.This does speed up website.Nowadays speed being one major factor in visitor experience as well as search engine optimization CDN has become integral part of any webmaster’s strategy.

How Content Delivery Network CDN can speed up website?

I will go back to above illustration once more.Your website is hosted on a server located in say US.Now a visitor from India browses your webpage which consists of HTML,JS,IMAGE etc.So lets understand things going on behind the scenes.

The browser located in India (visitor location) needs to downloads all the resources present in your webpage (CSS,JS,IMAGE) to show your webpage.The data is downloaded from your server at US to browser at India.As the distance between server and client (web browser) increases this download time increases.Now if you had a server in India and visitor from India then the webpage will download much faster.

This is the idea behind content delivery network CDN.If you are using content delivery network or CDN for your website then static resources of your website likeĀ CSS,JS,IMAGE files will be hosted on content delivery network.

Now lets go back to previous example once more.You are using CDN and a visitor from India requests your webpage.In current case your static resources like IMAGE,CSS,JS will be loaded from server nearer to India instead of your own server in US.This will speed up website in whole.

CloudFlare the Free Content Delivery Network

Content Delivery Network really works great.It does speed up website ten folds.It is even more important if you are using shared hosting.Having said that Content Delivery Networks are costly.But I am going to introduce you to free content delivery network CloudFlare.

CloudFlare provides free CDN functionality.It also provides extra layer of security as well.CloudFlare is not entirely free.SSL feature comes at a cost.But the free features are the ones used by most of us.

Speed up website with CloudFlare

Having seen benefit of content delivery network and knowing about a free content delivery network lets start configuring it for your website.I am outlining detailed step by step process to signup and configure CloudFlare for your website.

Signup for CloudFlare

The first step is signing up for CloudFlare using this link.The sign up form looks as shown below

CloudFlare signup
cloudflare-signup-page

You will have to enter your email address and a password of your choice to get started.After filling up the form click on create account now.

Add website

On the next screen as shown below you should add the domain name you want to speed up with CloudFlare content delivery network.You can add multiple website later on.For now it is good to add one domain and then click on Ad website button.

CloudFlare add website
cloudflare-add-website

Configure your records

On next screen CloudFlare will scan your website.This does take around one minute time or couple of minutes.You will see below screen while scan is in progress.After scan is complete click on the continue button.So far things were pretty simple and do not need anything technical but things from here on will be bit complex so stay with me.

CloudFlare configure your records
cloudflare-configure-your-records

DNS Records for your website

After scanning CloudFlare will show DNS records for your website as shown below.The picture below shows DNS records for this website.You will have more entries than my website but there is nothing to get worried.Check DNS records of your website and activate CloudFlare for only below entries ( see the name column)

CloudFlare DNS records
cloudflare-dns-records
  1. your domain name
  2. WWW
  3. any sub domain

For rest of the entries in DNS records De-activate CloudFlare.

Choose Initial Settings

CloudFlare provides below services and this screen allows you to select services for your domain.You can change these settings later on.You can also fine tune the setting later on as well.The services provided are (I am only listing the free services)

  • Content Delivery Network service — loads your static files from CloudFlare network.
  • Security service — protects your website from spam and DDOS attacks.It comes in three levels High,Medium,Low and Off.
  • Rocket Loader — It is advanced JavaScript loader which speed up website ten folds.But is not compatible with Google Adsense (for details and solution read this post) and few other advertising networks.It also has some compatibility issues with third party commenting systems like Livefyre.But it works well with Facebook comments and Disqus.

Below is the screen shot of initial setting screen.I have selected CDN + Full Optimization for performance and security as low.You can select them based on your requirement.But I am sharing few tips to help you decide the settings

CloudFlare Setting Page
cloudflare-settings-page

Security Setting tips

  • Security setting of High is not advisable for most of the blogs and website unless security is of utmost importance for your website.
  • Blogs should use Low as security settings.As many of your visitors may not have secure desktop or browsers or might have history of comment spamming.
  • eCommerce websites can go with Medium setting without any issues.

Performance Setting tips

CloudFlare rocket loader is great way to speed up website but is not compatible with advertising networks like Google Adsense.RocketLoader is inlcuded in CDN+Full optimization setting.So in case you are using Google Adsense then it is preferable to use CDN+Basic Optimizations or CDN only.

After selecting the settings click on the button to move on to next screen.

Update your Name Servers

This is most complicated part of CoudFlare configuration for your website.The question is where to update the name-servers.You will see list of your current name-servers and change your name servers to on this page.

CloudFlare Update NameServer
cloudflare-update-name-servers
  • You should have received user name and password to log into your hosting provider.This is different from your cPanel or Plesk login details.There you can see NameServers for your domain.You can also ask your hosting provider for the same.I am producing the picture of from my account for your reference
  • Enter the Name Servers as shown in below picture (it is same as the nameservers shown on CloudFlare change name servers screen).
  • Save the settings.
  • It takes around 24 hours for NameServer propagation.Once it is complete your website will be powered by CloudFlare.
Change Name Server
change-name-servers

CloudFlare with Apache Configuration

CloudFlare works as reverse proxy means all requests to your website comes through CloudFlare.So instead of real ip address of visitor you see ip address of CloudFlare.This is not desirable.So to see real ip address instead of CloudFlare ip address follow below steps

  • Ask you web hosting company to install mod_cloudflare.This is Apache server module and is required to get real ip address instead of cloudflare ip address.It is available for free.You should not have issue get this installed.I got this installed while using shared hosting.
  • In case you are using WordPress then install CloudFlare plugin for WordPress.It is free plugin and you can download it from this link.

Above steps assume you are using Apache web server.This is the case if you are using Linux shared web hosting.If you are not sure which web server is being used then contact your web hosting company.

CloudFlare with Nginx

You will need configuration changes to get real ip address from cloudflare ip address.Follow below steps for this purpose

  • Install Nginx with HttpRealipModule.In case you have installed Nginx on your Ubuntu or Debian Server using apt-get then you have this module already installed.
  • Open your nginx configuration file.On debian system it is /etc/nginx/nginx.conf.
  • Add below lines in http section of nginx configuration file.Remember http section starts with http { and ends with }.You can add these lines between these two.
    ##
    # CloudFlare
    ##
    set_real_ip_from   204.93.240.0/24;
    set_real_ip_from   204.93.177.0/24;
    set_real_ip_from   199.27.128.0/21;
    set_real_ip_from   173.245.48.0/20;
    set_real_ip_from   103.22.200.0/22;
    set_real_ip_from   141.101.64.0/18;
    set_real_ip_from   108.162.192.0/18;
    set_real_ip_from   190.93.240.0/20;
    set_real_ip_from   188.114.96.0/20;
    set_real_ip_from   198.41.128.0/17;
    set_real_ip_from   2400:cb00::/32;
    set_real_ip_from   2606:4700::/32;
    set_real_ip_from   2803:f800::/32;
    set_real_ip_from   127.0.0.1/32;
    real_ip_header     CF-Connecting-IP;
  • CloudFlare ip address changes from time to time.So it is better to check for updates and modify the configuration file.You can get updated list of CloudFlare ip address from this link.

Next Steps

Read these tutorials to make most out of CloudFlare

Hope you enjoyed this post.In case you found this useful consider sharing it.

7 thoughts on “CloudFlare Free content delivery network speed up website

  1. certainly like your web site but you need to test the spelling on quite a few of your posts. Several of them are rife with spelling issues and I to find it very troublesome to tell the truth then again I will definitely come back again.

    • thanks for your feedback..will take care of issue also can you point out areas or posts

  2. Hello,
    I have gone through your article and i must say that it is very impressive you have really dona a good work. Here is a site from which you can also increase your knowledge in the field of Web Hosting-

    http www dot thewebartists dot com/services-hostingsolutions.php

  3. Nice article and I have that you are a great blogger help for my blog guruofmovie blogspot in/

    • Thanks for your comment

  4. Cloudflare is now providing https support in FREE accounts too!

    • Thanks for the information Need to check the https support

Leave a Comment