Cloudflare is one of the best Free CDN options for small business websites or small blogs. Her goes How to setup Cloudflare for your Self Hosted WordPress or any other website or Content Management System. Before that you may or may not know about Cloudflare, So I will take you to an introduction explaining what exactly Cloudflare is and how it can be helpful to your Website.
When I started blogging I did it on Blogger. Everything was finely running till when I decided to move my website from Blogger to WordPress on Dreamhost. I started observing performance issues on my website, searched a lot on Google how can I speed up my website but to no luck I returned without a perfect answer. Either the answer was put some more money and get a better hosting or deploy a CDN for faster delivery of static contents etc.
I had an option to setup a free Clodflare account on my Dreamhost account, which I did it unknowingly what will be the impact. I did not notice much on the performance side because I did not had many visitors to my site. But later on I disabled it because I saw many 502 server error after setting up Cloudflare thinking that Cloudflare is not of much useful or at least is not going to help you much on shred hosting.
How did I secured my WordPress Website by setting up Cloudflare on it:
Some days back I noticed on my other website that my wp-admin or wp-login.php access has been barred for security reasons because of too many login tries. Definitely it was not me who was making too many login tries to my own website because it will take a maximum of two attempts for me to login. I quickly searched the net to see what is happening around and what may be the impact of what I just have witnessed. It is possible that many spam bots are setup to go for Brute Force Attack and one of them is attacking your website. I found that it was a newly setup website and hence I did not take any measure to make it secure. After my research I have gathered few things that will save your self hosted WordPress website:
Out of everything, the best possible solution I found to make my website free from attacks is just to setup Cloudflare on my WordPress powered website. You can also set it up on any other website. Let the problem be handled by Cloudflare’s network. Cloudflare has spam filtration technique at DNS level which will blacklist spam requests entering to your web server. As I already had a Cloudflare account setup, I just logged-in to Cloudflare and added my website to my FREE Cloudflare account. I am not going to explain many things on Cloudflare’s network because I won’t be able to and you won’t be able understand at the same time.
You can see here for more info on how Cloudflare exactly works and protects websites behind it.
What benefits you get of setting up Cloudflare:
The answer lies in a question that how much benefits you can take from Cloudflare. For instance I have captured an image that speaks key features of Cloudflare:
Including a secured website, it gives you FREE CDN (Content Delivery Network) setup which will deliver contents to your visitors in fastest possible way and from nearest possible geographical location from their distributed networks. It also gives you options to add caching, minifying JS, CSS and HTML content straight away from the Cloudflare account. So, no need to setup other caching plugins on your WordPress website. Added to these there are many more useful stuffs which are yet to be explored.
I have to list the following benefits from Cloudflare:
- First of all your Website is secured behind Cloudflare.
- Next is, Cloudflare offers you FREE CDN.
- Cloudflare has always Online technique which keeps your website accessible (by caching some of your web pages) even your server is down from your hosting side.
- You can optimize your website by enabling Caching and Minifying your content.
- You can monitor traffic and attacks to your website etc.
- Many application (mostly paid services) support that will enhance your website and reduce WordPress plugin usage.
There are many more to the list added above. The more I will explore the more I will add in the list for your reference.
How to setup a WordPress website or any website in Cloudflare:
Cloudflare will only host the nameservers for your website. In simple words a Nameserver is responsible to resolve the URL (e.g. www.infysim.org) to corresponding IP address (e.g. 220.127.116.11).
First of all Signup free account on Cloudflare.
Login to your Cloudflare accound and then click on Add site.
Then write your website name (e.g: www.infysim.org) on the text box and then click on Begin Scan.
When the scanning is complete you can click on Continue Setup. If you have any ERROR in this step then go and resolve, and the add your website again.
If successfully scanned, the DNS entries for your website will be shown. Just verify if everything is OK. If you don’t know what this is then just click on Continue and move ahead.
Sometimes, some of the subdomains may not be shown in this step and hence if you will go ahead and setup Cloudflare then your subdomains will not work. Carefully add your subdomain A or CNAME records in this step.
Choose for a free plan in the next step and click on Continue.
Now you will be shown two Nameservers. This you have to modify at your domain registrar. Remember that the Domain registrar is where you have registered your domain name (e.g: www.infysim.org is my domain name) which may be different from your hosting provider. For example: My domain registrar is goDaddy but my hosting service provider is InMotion hosting.
Go to your domain registrar and change the existing Nameservers to that provided in this step.
The DNS transition will take place in the background and there will be no site downtime that you will observe. The maximum DNS propagation time is 24 hours meaning it may take upto 24 hours for the new DNS address to be active.
That’s all my friend. I hope if you have reached means you have already setup your website on Cloudflare or simply you are judging my writing. Anyways, I will follow-up with some more posts on how to use or enable/disable different services provided by Cloudflare on your account.
If you have any troubles setting up your Website on Cloudflare then feel free to place a comment in the comment box. I will be happy to answer your queries.