Cloudflare is a company that provides content delivery network (CDN), DNS, DDoS protection, and security services. They have become very well known in the web performance industry for fast DNS lookup times and have a robust network of over 100 different data centers around the globe. They are backed by some of the biggest names in the industry such as Google, Microsoft, and Qualcomm. Some of their clients include Nasdaq, Digital Ocean, zendesk, and Cisco.
If you are looking for an easy way to speed up and enhance the security on your WordPress site, Cloudflare is a great solution. Most customers can even utilize their free plan, which offers unlimited CDN bandwidth. Follow the steps below on how to install Cloudflare on your WordPress site. It works great with Kinsta and in fact we even recommend it to a lot of our customers.
#1. Install Cloudflare
This tutorial assumes you already have a Cloudflare account. If you don’t, you can visit the Cloudflare website and signup for a free account.
#1. Login to the Cloudflare dashboard and click on “+ Add Site.” Input your WordPress site’s domain and click on “Begin Scan.” (You don’t need to add www or HTTP/HTTPS, the root domain is fine). It may take a minute or two and then click on “Continue Setup.”
#2. Cloudflare gives you two options. You can use their CDN and protection (which accelerates and protects your sites) or you can simply use their DNS. Most customers will want the former, as this is where you will benefit from everything Cloudflare has to offer. To ensure that your domains are enabled, make sure the cloud is lit up as orange. If you have additional records, such as email (MX records), these should be off cloudflare (grey). Click on continue after you have verified everything. You can always modify these records later on.
#3. On the next page you will need to select a Cloudflare plan. We recommend starting with the free plan, which works for most users. Then click “Continue.” You can read more about the differences in Cloudflare’s plans.
#4. You will then need to change the nameservers on your domain to point to Cloudflare (use the ones they provide). Because Cloudflare is a full proxy service, basically how it works is you point your domain to Cloudflare, and Cloudflare then points your domain to Kinsta. There is no downtime when you switch your nameservers. This shouldn’t take very long, but allow up to 24 hours for this change to be processed.
#5. There is an additional step for WordPress users which we do recommend. It is not required, but certain things with Cloudflare might not function properly if you don’t install the official Cloudflare plugin.
You can download it from the WordPress repository or by searching for it within your WordPress dashboard under “Add New” plugins. It features the following:
- Fix for WordPress comments appearing from the same IP address
- Automatic cache purging
- Header rewrite to prevent a redirect loop when Cloudflare’s Universal SSL is enabled
- Ability to change settings on Cloudflare account from within plugin itself (cache purge, security level, image optimization, etc.)
- View analytics such as total visitors, bandwidth saved, and threats blocked
- Support for HTTP2/Server Push
After you install the plugin you will need to input your Cloudflare email address and API key in the settings. You can grab your API key here. Copy the one that says “Global API Key.” Then click on “Save API Credentials.”
Under the “Home” tab you apply the default settings or update settings as you prefer.
Under the “Settings” tab you can enable image optimization if you are on a pro plan, turn on development mode, change the security level, and enable automatic HTTPS rewrites.
Under the “Analytics” tab you can view the number of requests, bandwidth, visitors, and threats on your WordPress site.
#2. Common Cloudflare Problem
A very common error that users get when trying to install Cloudflare on their WordPress site is “ERR_TOO_MANY_REDIRECTS” in Chrome or “The page isn’t redirecting properly” (Firefox).
This is due to having SSL setup on your web server already and then having Flexible SSL enabled with Cloudflare. If you have an SSL certificate with your web host (Kinsta) already, then you will want to switch the SSL mode to full. Otherwise, you can create a page rule to fix this issue.
#3. Additional Cloudflare Settings
Now that you know how to install Cloudflare, we recommend checking out their first steps documentation, as well as their WordPress suggestions guide. Note: If it mentions mod_cloudflare just be aware that it’s an Apache mod and we don’t run it because we’re using more advanced NGINX web servers.
#4. How Much Is My Website Bandwidth Usage If I Use CloudFlare?
When you use a CDN such as CloudFlare, this can save you a lot of bandwidth because the CDN does the heavy lifting. It’s easy to find out your total website bandwidth usage and the “saved bandwidth” if your site is behind CloudFlare.
Please follow the steps below:
- Log in to your CloudFlare account.
- Click on the domain, Click on the *Analytics* tab, then the *Bandwidth* tab.
- Click on the dropdown menu in the upper right corner and select “Last month”.
- Scroll down to *Performance* and check the *Bandwidth saved* section. Under the icon, You’ll see “Total Bandwidth” and “x TB saved”.
Total Bandwidth is the amount of data transferred through your website in the selected period, a part of which CloudFlare’s CDN “saves” for you, meaning that their CDN automatically caches your static files at their edge nodes so these files are stored closer to your visitors while delivering your dynamic content directly from your web server.