Knowledge Base

How to configure CloudFlare

This article describes how to use cPanel to configure CloudFlare for your web site.

  • This article assumes that you have already activated CloudFlare for your account and are ready to configure it. If you have not activated CloudFlare yet, please see this article.
  • To use the CloudFlare cPanel plugin, your account domain must use A2 Hosting's name servers.

Configuring CloudFlare

After you activate CloudFlare, you are ready to configure it for your web site. This process involves enabling CloudFlare for certain domains on your web site.

CloudFlare only accelerates and protects domains that have CNAME (canonical name) records. However, the root domain (example.com) uses an A record and cannot be routed directly through the CloudFlare network. Therefore, to make sure CloudFlare handles all traffic to your site, you should use an .htaccess file to forward root domain requests to the www domain.

If you do not forward traffic from the root domain, traffic to www.example.com will be accelerated and protected by CloudFlare (and shown in site statistics), but traffic to example.com will not.
Using the cPanel plugin to configure CloudFlare

The following sections describe how to use the cPanel plugin to configure CloudFlare for your domain.

Enabling CloudFlare

If you activated your CloudFlare account using cPanel, use the integrated CloudFlare plugin to configure your site. To do this, follow these steps:

  1. Log in to cPanel.
    If you do not know how to log in to your cPanel account, please see this article.
  2. In the SOFTWARE section of the cPanel home screen, click Cloudflare. The plugin loads the current CloudFlare configuration for the primary domain.
  3. At a minimum, you should make sure CloudFlare is enabled for your domain's www CNAME record. To do this, follow these steps:
    • Locate the CNAME record for your www domain:

      cPanel - CloudFlare - CNAME-WWW record

    • If the Use Cloudflare column value is set to Off, click it to turn CloudFlare on.

      It can take a few minutes for the DNS changes to propagate through the CloudFlare network.

      The CloudFlare network only proxies web traffic on ports 80 (non-secure HTTP) and 443 (secure HTTPS). Therefore, to prevent possible performance issues, you should not enable CloudFlare for any of the following subdomains:

      • cpanel
      • ftp
      • mail
      • webdisk
      • webmail
      • secure
      • whm
      • Name servers (for example, ns1.example.com or ns2.example.com)

      To view a complete list of subdomains that should not be used with CloudFlare, please visit https://support.cloudflare.com/hc/en-us/articles/200169626-What-subdomains-are-appropriate-for-orange-gray-clouds-.

  4. To disable CloudFlare, when the Use Cloudflare column value is set to On, click it to turn CloudFlare off for the specific domain.
Changing Cloudflare settings

To change Cloudflare settings using the cPanel CloudFlare plugin, follow these steps:

  1. Log in to cPanel.
    If you do not know how to log in to your cPanel account, please see this article.
  2. In the SOFTWARE section of the cPanel home screen, click Cloudflare.
  3. Click Home. The following options appear:
    • Always Online: To allow CloudFlare to display cached content to visitors even when your server is unavailable, confirm that this option is set to On.
      For more information about CloudFlare's Always Online™ feature, please visit https://www.cloudflare.com/always-online.
    • IPv6 Compatibility: A2 Hosting currently does not support IPv6 addressing.
    • Caching Level: You can select a caching level for your site, but Cloudflare recommends the Standard level.
    • Railgun: For information about Railgun, please see this article.
    • Purge Cache: To clear all of your web site resources from CloudFlare's cache, click Purge Cache.
  4. Click Settings. The following options appear:

    • Security Level: The default security level is Medium. CloudFlare recommends using a Medium or High security level setting during normal site operation.
    • Challenge Passage: You can specify how long a visitor is allowed to access your site after he or she successfully completes a challenge.
      Challenges only appear when a visitor attempts to access your site from an IP address that is suspected of hosting malicious bots.
    • Browser Integrity Check: When this option is enabled, CloudFlare examines HTTP headers for possible threats.
    • Auto Minify:  When this option is enabled, CloudFlare reduces the size of your site's files by removing unnecessary characters (such as tabs, comments, and spaces). This can help improve site performance.
    • Developer Mode: When you are developing your site, you probably want to be able to see changes immediately. To bypass CloudFlare's cache during development, make sure this option is set to On.
    • Browser Cache Expiration: You can specify how long cached files are saved in visitors' browser caches.
There may be certain CloudFlare features and settings that you cannot manage using the cPanel plugin. You can manage these features instead by logging in to CloudFlare directly.

 

Viewing site statistics

To view site statistics using the cPanel CloudFlare plugin, follow these steps:

  1. Log in to cPanel.
    If you do not know how to log in to your cPanel account, please see this article.
  2. In the SOFTWARE section of the cPanel home screen, click Cloudflare.
  3. Click Analytics.
  4. Click the appropriate tab for the type of statistics you want to view:
    • Requests: This tab displays statistics about requests to your site through Cloudflare.
    • Bandwidth: This tab displays information about the amount of bandwidth used through Cloudflare.
    • Unique Visitors: This tab displays statistics about the number of visitors to your site.
    • Threats: This tab displays information about any threats to your site over the past month.
    CloudFlare updates site statistics every 24 hours.
Enabling DDoS protection

You can use Cloudflare to help defend against DDoS (distributed denial-of-service) attacks on your site. For information about how to do this, please see this article.

Using the CloudFlare site to configure CloudFlare

You may have activated your CloudFlare account directly through the CloudFlare web site. If so, then you should also configure your CloudFlare settings by logging in directly to https://www.cloudflare.com instead of using the cPanel plugin.

More Information

For more information about CloudFlare, please visit https://www.cloudflare.com.