One of the most important parts of building your websites, is making sure they load fast. It’s not a surprise – these days web page loading speed is an important factor for search engine rankings. There are many ways to speed up WordPress websites, for example, using a caching plugin like WP Super Cache, optimizing images or using a Content Delivery Network (CDN). The best results can be achieved using all these methods in conjunction.
In this tutorial, you will learn to setup CloudFlare for your WordPress website hosted on Hostinger WordPress hosting and configure WordPress CloudFlare plugin.
Table of Contents
- What is CloudFlare CDN
- What you’ll need
- Step 1 — Creating CloudFlare account
- Step 2 — Adding Domain Name to CloudFlare
- Step 3 — Checking DNS records for your domain name in CloudFlare
- Step 4 — Pointing your domain name to CloudFlare nameservers
- Step 5 – Installing and Configuring CloudFlare Plugin on WordPress
What is CloudFlare CDN
CloudFlare is a content delivery network which acts as a proxy between the website and visitor. It serves cached static content from the nearest location (CloudFlare has multiple servers around the globe), thus making website loading speed faster. Moreover, CloudFlare handles all requests to a website and can offer more useful services compared to traditional CDN:
- DDoS attack mitigation
- Analytics on all requests made to a website
- Easy SSL certificate installation
- Network gateway between protocols
What you’ll need
Before you begin this guide, you’ll need the following:
- Access to your domain name registrar control panel
- Access to WordPress admin area
Step 1 — Creating CloudFlare account
Navigate to official CloudFlare website and click Sign Up button in order to create an account on CloudFlare. Fill all the required details and create an account.
You can skip this step, if you already have an account.
Step 2 — Adding Domain Name to CloudFlare
After you have signed up with CloudFlare, you will be prompted with add your website window. Enter your website domain name and click on Scan DNS Records button in order to proceed.
Note that it may take several minutes for the scan to be completed.
Step 3 — Checking DNS records for your domain name in CloudFlare
After the scan has been finished, you will be prompted with your domain name DNS details. In this step, you can enable or disable CloudFlare for specific subdomains. Orange Cloud enables the CloudFlare and Grey Cloud disables the CloudFlare for a specific DNS record.
It’s recommended to enable CloudFlare for your naked domain name and www subdomain (as displayed in the picture). This way CloudFlare will work on both www and non-www versions of your domain. Once you are done, press Continue button to proceed to the next step.
IMPORTANT: It’s not recommended to enable CloudFlare for cpanel, mail, ftp or any other system reserved subdomains as it can result various DNS issues.
Step 4 — Pointing your domain name to CloudFlare nameservers
In this step, you will be asked to choose CloudFlare plan. Select a free plan and press Continue button again.
Now you will be given CloudFlare nameservers. Login to your domain registrar control panel and update your domain nameservers to CloudFlare nameservers. If you are not sure how to change your nameservers, you can follow this tutorial.
Once again, press Continue button.
Note that it may take up to 72 hours for DNS to propagate worldwide. Once nameservers update has been completed, you will receive an email confirmation message from CloudFlare. You can also check status on CloudFlare website. Your website will not face any downtime during this process.
Step 5 – Installing and Configuring CloudFlare Plugin on WordPress
CloudFlare has a great plugin for WordPress, which comes with some handy features:
- One-click WordPress optimization
- Web application firewall (WAF) rulesets
- Automatic cache purge
- Ability to change Cloudflare settings without needing to open the cloudflare.com dashboard
Login to your WordPress admin area and install CloudFlare WordPress plugin. If you are not sure how to install plugins, see this tutorial.
Once the installation is complete, begin the configuration of the CloudFlare plugin. Navigate to Plugins section and click on Installed Plugins button. Find the CloudFlare plugin and click on Settings button.
You will be prompted by the CloudFlare login page where you will need to enter your email address and API key. Click on Get your API Key from here button. A window will pop up which will open your CloudFlare account where you will be able to find your API Key under API KEY section.
Once you have obtained your API Key, enter your email address and API Key inside your WordPress website and click on SAVE API Credentials button.
When transferred to your CloudFlare settings page, click on Apply button under Apply Default Settings section. You can use default CloudFlare settings for WordPress websites.
It’s highly recommended to enable Automatic Cache by clicking on Apply button in Automatic Cache section. Enabling Automatic Cache purge will clear the entire CloudFlare cache when your website design is updated.
Congratulations, you have learned to activate CloudFlare for your blog and configure CloudFlare WordPress plugin. This is a great way to speed up your website and protect it against DDoS attacks.