Have you been looking for an easy way to speed up your website and add an extra layer of security? Look no further. In just a few minutes, you can install Cloudflare on your cPanel and reap the benefits. Cloudflare is a content delivery network (CDN) and web application firewall (WAF) that acts as a middleman between your hosting server and the rest of the internet. By routing your site’s traffic through Cloudflare’s global network, they can speed up load times, block threats, and give your site a performance boost —all for free. Installing Cloudflare on your cPanel account is super simple and only takes a few clicks. In this step-by-step guide, we’ll walk you through the entire process so you can have Cloudflare up and running on your site in under 5 minutes.
Why Use Cloudflare With cPanel?
Why Use Cloudflare With cPanel?
Cloudflare is a content delivery network (CDN) and web application firewall (WAF) that provides essential security and performance tools for websites. Using Cloudflare with cPanel helps protect and speed up your cPanel-hosted website.
First, Cloudflare acts as a firewall by blocking malicious traffic before it reaches your server. This includes DDoS attacks, SQL injections, cross-site scripting, and other threats. Cloudflare can detect and mitigate these attacks to keep your site secure.
Cloudflare also caches static content like images, CSS, and JS files. By storing copies of this content in data centers around the world, Cloudflare speeds up load times for your visitors no matter where they are. Your server has less work to do, and pages load faster.
With Cloudflare, you get additional benefits like free SSL certificates to enable HTTPS on your site, IP masking to hide your server’s IP address, and a web application firewall to block malicious bots.
To use Cloudflare with cPanel, you just need to sign up for a Cloudflare account and add your cPanel site’s domain name. Cloudflare will provide nameservers to use in cPanel’s DNS settings. Once the nameservers are updated, Cloudflare starts routing all traffic to your site through its network.
In just a few clicks, you can enable powerful security and performance tools to keep your cPanel-hosted website fast, protected, and optimized. Using Cloudflare with cPanel is an easy way to take your site’s security and speed to the next level.
Signing Up for a Cloudflare Account
To get started using Cloudflare, you’ll need to sign up for an account. It’s free and only takes a couple of minutes.
Signing Up
Head over to cloudflare.com and click the orange “Sign up” button. You’ll be asked to provide an email address and create a password. Once you’ve verified your email, your account will be set up.
Now you’re ready to add your first website. When you log in, you’ll see options to add a domain or subdomain. Enter your cPanel domain name and click “Add site”.
Cloudflare will then scan your domain to detect settings. This typically only takes a few seconds. You’ll see options to select a plan—for now, the free plan should work great. You can always upgrade later if you need additional features.
With your site added, Cloudflare will provide you with DNS addresses to use in place of your current nameservers. In cPanel, go to Advanced DNS Zone Editor and enter the Cloudflare nameservers. Your site may experience brief downtime during the transfer, but will be back up and running within the hour.
Once the transfer is complete, Cloudflare will automatically start optimizing your site. You’ll get benefits like DDoS protection, CDN for faster load times, and security tools like web application firewall—all at no cost. You’ll be able to see metrics on threats blocked and web traffic in your Cloudflare dashboard.
Getting set up with Cloudflare is really straightforward. In just a few simple steps, you’ve added an extra layer of security and performance for your cPanel site. If you do run into any issues, Cloudflare’s support team is available 24/7 to help. Your site will be safer and faster in no time!
Locating Your Nameservers in cPanel
Locating your nameservers in cPanel is an important step to get Cloudflare setup. The nameservers are what direct your domain to the Cloudflare network.
Once you’ve signed up for Cloudflare and added your domain, you’ll need to log into your cPanel account to update the nameservers. Here’s how:
Find Your cPanel Login
First, you’ll need to log into your cPanel account. This is the control panel provided by your web host that lets you manage your domain. You should have received login info from your web host when you purchased your domain.
If you don’t have your cPanel login info, contact your web host’s support team. They can provide your cPanel URL, username, and password.
Locate the Nameservers Option
In cPanel, look for the “Nameservers” or “DNS” option. This may be under a “Domains” or “Advanced” menu.
The nameservers option allows you to manage the DNS records for your domain. This includes setting the nameservers, which direct your domain to Cloudflare.
Enter the Cloudflare Nameservers
Once you find the nameservers option, you’ll enter the two Cloudflare nameservers provided in your Cloudflare dashboard. They will look something like:
ns1.cloudflare.com
ns2.cloudflare.com
Double check that the nameservers match exactly. Any typos will prevent your domain from connecting to Cloudflare properly.
Allow Propagation Time
After entering the two Cloudflare nameservers and saving the changes, it can take 24-48 hours for the nameserver change to fully propagate across the internet. This means it may take a day or two for your domain to be fully active on the Cloudflare network.
Be patient during this time. Cloudflare and your DNS records will not show as active until the nameserver change has propagated. Once propagation is complete, you’ll be able to log into your Cloudflare dashboard to continue setting up your domain.
Let me know if you have any other questions! I’m happy to help explain any part of the Cloudflare setup process.
Changing Nameservers to Cloudflare
To use Cloudflare with your cPanel account, you’ll need to change your domain’s nameservers to Cloudflare. This redirects your domain’s traffic through Cloudflare’s network, enabling their security and performance features.
Find your domain’s current nameservers
Log in to your domain registrar’s account, like GoDaddy or Namecheap. Locate the nameserver (NS) records for your domain. The names will be something like ns1.example.com and ns2.example.com. Make a note of these current nameservers – you’ll need them if you ever want to disable Cloudflare.
Locate your Cloudflare nameservers
Log in to your Cloudflare account and select your domain from the list. The page will show your Cloudflare nameservers, which will be four numbers separated by periods, like 1.2.3.4 and 5.6.7.8.
Change nameservers at your registrar
Return to your domain registrar’s account and find the section for managing nameservers. It may be called “Domain Nameservers” or “Nameservers”. Delete your current nameservers and enter the two Cloudflare nameservers.
Verify the change
It can take 24-48 hours for nameserver changes to fully update across the internet. To check if your domain is using the Cloudflare nameservers, you can use a “dig” command at your cPanel. Or you can check with a free nameserver lookup tool. Once the change is complete, Cloudflare’s features like caching, firewall rules, and DNS filtering will be active for your domain.
If you ever want to disable Cloudflare in the future, simply change your domain’s nameservers back to your original registrar’s nameservers. But Cloudflare’s security benefits are well worth using long-term! Let me know if you have any other questions about setting up or using Cloudflare.
Setting Up Cloudflare DNS Records
Now that you’ve installed Cloudflare and connected your cPanel account, it’s time to set up the DNS records that will direct traffic to your server. DNS records tell the internet how to find your website.
A Records
A records point a domain or subdomain to an IP address. You’ll need to create A records for:
- Your root domain (example.com)
- www (www.example.com)
- Any other subdomains (blog.example.com, store.example.com)
To add an A record in Cloudflare:
- Log in to Cloudflare and select your site.
- Go to the DNS page.
- Click “Add record” and select “A – IPv4 address”.
- Enter the hostname (e.g. www) and point it to your server’s IP address.
- Keep the TTL (Time to Live) at the default of 1 hour.
- Click “Save”.
Your A records are now set up and traffic will start flowing to your server within the TTL period.
CNAME Records
CNAME records point a domain or subdomain to another domain. You’ll want to create CNAMES for:
- www (to point www.example.com to example.com)
- Any subdomains (blog.example.com to example.com, store.example.com to example.com)
To add a CNAME record in Cloudflare:
- Click “Add record” and select “CNAME”.
- Enter the subdomain (e.g. blog) in the Hostname field.
- Enter your root domain (example.com) in the Target field.
- Leave the TTL at 1 hour.
- Click “Save”.
Your CNAME records will now direct traffic from subdomains to your root domain.
With your A and CNAME records set up correctly in Cloudflare, your site’s DNS is all configured and traffic should start flowing to your server. Let me know if you have any other questions!
Enabling Proxy Status in Cloudflare
Enabling Proxy Status in Cloudflare
To enable Cloudflare’s proxy service and cache your site’s content, you’ll need to adjust some settings in your Cloudflare dashboard. The proxy service helps speed up your site by caching static content like images, CSS, and JavaScript files.
Check your DNS settings
Make sure your nameservers are pointing to Cloudflare. This allows Cloudflare to act as a proxy for your domain. You can find your nameservers in the “Nameservers” section of your cPanel. They should be:
- ns1.cloudflare.com
- ns2.cloudflare.com
If they’re not, you’ll need to update them before continuing.
Adjust the Cloudflare proxy status
In your Cloudflare dashboard, select the domain you want to enable the proxy service for. Go to the “Proxy” tab. Under the “Proxy status” section, select “Flexible” from the dropdown menu. This will enable the Cloudflare cache and proxy.
Cache Level Settings
Under “Cache level” choose a setting based on how often your content changes. For most sites, “Standard” or “Aggressive” works well. “Aggressive” has a longer cache time but may require you to purge the cache more often. “Bypass” means no caching. I would not recommend choosing “Bypass” unless you have a specific need.
Page Rules
Page rules allow you to customize the cache settings for specific URLs or paths on your site. For example, you may want “no cache” for a blog page but “aggressive” caching for your home page. Add any page rules you need, then click “Save and Deploy” at the top of the page.
Purging the Cache
If you make changes to your site content, you’ll need to purge the Cloudflare cache to update the proxied version of your site. You can purge the cache in the “Purge Cache” section of the “Proxy” tab. Purge your entire cache or enter specific URLs or page paths to purge. After purging, it can take up to 30 minutes for the changes to update across Cloudflare’s global network.
Setting Up Page Rules in Cloudflare
Now that Cloudflare is installed and protecting your cPanel website, you can configure Page Rules to customize how Cloudflare handles your traffic. Page Rules allow you to set rules for handling requests that match a URL pattern you specify.
Creating a Page Rule
To create a Page Rule in Cloudflare, follow these steps:
- Log in to your Cloudflare account and select the domain you want to configure.
- Go to “Page Rules” under the “Firewall” section.
- Click “Create Page Rule”.
- Enter a name for your rule that is easy to remember. Something like “Cache static files” or “Bypass cache for contact form”.
- Specify the URL pattern to match. This can be:
- An exact URL like
/contact.php
- A wildcard pattern like
/*.css
to match all CSS files - A regex pattern for more complex matches
- Choose the action for the rule. The most common options are:
- Cache Level: Choose how long Cloudflare will cache the matched content.
- Always Online: Keep the URL available even if your origin server goes down.
- Security Level: Choose a different security setting for the match.
- Bypass Cache: Skip caching for the matched content. Useful for contact forms.
- Select additional options like browser cache settings, device types, and more. The options shown depend on the action you choose.
- Click “Create Page Rule” to save your new rule.
- Test your rule by loading a URL that should match to confirm it’s working as expected. Make any necessary adjustments to the rule.
Page Rules give you a lot of control over how Cloudflare handles traffic to your cPanel site. Be sure to use them wisely to optimize performance, security, and reliability. Let me know if you have any other questions!
Optimizing Your Cloudflare Settings
Once you have Cloudflare installed on your cPanel, it’s time to optimize your settings. The default configuration works well for most sites, but you may want to customize options for your specific needs.
Change your Cloudflare plan
The free plan is great to start with, but if your site gets a lot of traffic or you need advanced features, consider upgrading. The Pro plan adds options like caching, compression, and security upgrades. For major sites, Business or Enterprise plans offer complete DDoS protection and performance optimization. Compare plans to pick what’s right for your site’s requirements.
Set your cache level
Cloudflare’s cache stores static content to speed up load times. The longer content is cached, the faster your site will be. For most sites, start with the Standard option (cache static content for a day). You can increase to Aggressive (a week) or Cache Everything (a month) if your content doesn’t change often. For sites with frequently updated content, choose Basic (4 hours) or simplify (30 minutes). Monitor your site to ensure the cache level is optimal.
Enable security options
Cloudflare provides free SSL, which encrypts data between your site and visitors. Enable SSL to activate this. You can also enable options like JavaScript challenge (protects from bots), Hotlink protection (prevents others from leeching your images/files), and Rate limiting (protects from DDoS attacks). Review the list of security options to strengthen your site protection.
Set Page Rules
Page Rules allow you to customize settings for specific pages or content types on your site. For example, you may want to disable caching for your contact page so form submissions are instant, or increase the cache time for images. Create rules to optimize performance for key areas of your site.
Tweaking these Cloudflare options can significantly improve your site’s speed, security, and performance. Monitor how the changes impact your site and make further adjustments as needed. With the right configuration, Cloudflare will keep your site optimized and protected.
Troubleshooting Common Cloudflare and cPanel Issues
Sometimes issues can arise when installing or using Cloudflare with your cPanel account. Here are some common problems you may encounter and how to fix them.
Error messages when enabling Cloudflare
If you get an error when trying to enable Cloudflare through cPanel, first double check that you have entered the correct zone name and authentication email/API key. Also ensure that you have the proper Cloudflare permissions to make changes to the domain’s DNS records.
- Try disabling any other CDN or cache plugins you may have active. They can sometimes conflict with Cloudflare.
- Make sure your domain name has been properly registered and isn’t expired. Cloudflare requires an active domain to function.
- Clear your browser’s cache and cookies, then try enabling Cloudflare again. Old settings can sometimes interfere.
Website not loading or showing a 502/504 error
After enabling Cloudflare, if your website doesn’t load or shows an error message, there are a few things to check:
- Wait up to 24 hours for Cloudflare’s cache to clear and your DNS changes to fully propagate. This is common and typically resolves on its own.
- Ensure your domain’s nameservers have been updated to the Cloudflare nameservers. You may need to check with your domain registrar.
- Double check that you have entered the correct website URL/IP address in the Cloudflare dashboard. An incorrect address will cause a 502 or 504 error.
Loss of FTP/database access
When Cloudflare is enabled, it can block access to your FTP, SSH, and database ports. To regain access:
- Log in to the Cloudflare dashboard and go to your domain’s page.
- Under the “Firewall” tab, open the “Blocked requests” log. This will show any blocked requests from your server’s IP address.
- For each entry, click “Approve” to whitelist that port/request. You may need to approve ports 21 (FTP), 22 (SSH), 3306 (MySQL) and 5432 (PostgreSQL).
- Check that you now have access to your FTP, SSH, and database connections. You may need to flush your DNS again for the changes to fully update.
If you continue to face issues, Cloudflare and cPanel both offer helpful resources and support teams to get your site back up and running. With some troubleshooting, you’ll be caching and accelerating your site in no time!
Conclusion
So there you have it, you’ve successfully installed Cloudflare on your cPanel account. With Cloudflare handling your DNS and acting as a content delivery network, your website should load faster and be more secure. Cloudflare offers a lot of powerful features for free that can really improve your site’s performance and security. If at any point you get stuck or have additional questions, don’t hesitate to check Cloudflare’s help docs or submit a support ticket. They have an excellent support team ready to assist you. Congrats on taking this step to optimize and protect your website – your users will surely appreciate the improvements!