Our complete, illustrated step-by-step guide for Cloudflare setup takes out all the technical guesswork.
Let’s get started!
Table of Contents
Cloudflare DNS Benefits
Cloudflare’s domain name system (DNS) is one of the fastest and most reliable in the world. It is almost twice as Amazon’s Route 53 DNS and nearly three times faster than GoDaddy DNS!
By simply switching your website’s default DNS servers to Cloudflare’s, your domain will resolve faster and this will decrease your time-to-first-byte (TTFB). This will start the website loading process quicker.
Using Cloudflare’s DNS will cut down your website’s TTFB and load your website quicker for your users.
By default, domain registrars and hosting companies provide their own basic DNS servers to their customers but you can also choose to use your own custom DNS servers.
Although some hosting providers have a Cloudflare integration button in cPanel, it usually only has a few Cloudflare features. To take full a advantage of the entire Cloudflare platform, I highly recommend creating your own account with Cloudflare directly, which is what I will do with you in this guide.
Cloudflare CDN Overview
Cloudflare’s CDN is also among the fastest and largest in the world, nearing the top of the charts at CDNPerf. The main benefit of using Cloudflare over other CDN providers is the many other additional features that are included.
By proxying your traffic through Cloudflare, you will take load off of your own server and instead, static files will be served from Cloudflare’s vast global network of servers with over 330 PoPs.
This has three main benefits for your website:
- Faster file load times for your visitors due to a shorter geographical distance between your visitors and a Cloudflare PoP
- Decreased requests to your origin server
- Decreased bandwidth usage from your origin server
Many of Cloudflare’s other advanced features (both free and paid) such as Agro Smart Routing, APO and Zero Trust require proxying your traffic through them to reap the benefits, so I include setting up their CDN together with this guide.
Let’s get into it!
Setup Guide
Create and Setup Your Cloudflare Account
Let’s start by creating our own Cloudflare account directly through them.
Go to the Cloudflare website and then down below to the “Start for free” button.

Enter your email, create a strong password, verify that’s you are a human and then sign up. You will receive a verification email from Cloudflare. Once you get it, open the link and you will be asked to sign in with your new credentials.

Next, you will asked for the domain that you would like to connect. Enter your domain name and continue.
Cloudflare will also ask you what your policy should be for AI bots that may scrape your content.
By default, the best option is to Block on all pages as shown below and enable the checkmark to Manage AI bot traffic with robots.txt.

Next, Cloudflare will present several options on how to import your DNS records. The easiest way is to select Quick scan for DNS records as Cloudflare will try to automatically import them for you.

You will be asked what type of account you would like to create. Select the Free option down below and then Continue.

Import Your DNS Records
Next, Cloudflare will show you the all your current auto-detected DNS records to import over. This works most of the time as shown below.
Review all your imported records and then Continue.

Note the orange check mark next to each record for the Proxy status. When orange, this basically means that your traffic is being proxied (“going through”) Cloudflare’s network, which is what we want. Some of them might be grey which indicates that Cloudflare is only being used as a DNS provider (no proxy), which usually are left as is. Also note the yellow Pending Nameserver Update indicator.
If you recently made changes to your DNS records, Cloudflare might not auto-detect your records as the changes haven’t yet propagated. Just wait for some time and try again.
In some cases, Cloudflare won’t auto-detect your DNS records or may only partially detect them. In that case, you’ll be presented with a manual entry screen as shown below. Click on the Quick Scan button to see if Cloudflare can detect them automatically.

Update Your Nameservers
With your DNS records successfully imported, Cloudflare will assign you two new nameservers. You will need to go to your domain registrar or your web host (wherever you registered your domain) and replace your current nameservers with these.

Using Namecheap as an example, find your domain in the Domain List tab and select Custom DNS for your Nameservers. Copy and paste both Cloudflare nameservers and be sure to save. Then Continue below in Cloudflare.
Now, all you have t o do is wait for your DNS changes to propagate. This usually takes about 15 minutes, but can sometimes take longer. You’ll get an email update from Cloudflare once this is complete, so just sit back, relax and wait!

With your nameservers are successfully updated, you’ll be presented with a success screen and the Pending indicator will change to Active. We’ll now install a Cloudflare Origin Certificate.

Generate and Install Origin Certificate
Now that we’re using Cloudflare’s nameservers, we need to make an origin certificate at our website host. We do this to guarantee the connection between Cloudflare and our origin server is always encrypted and secured with a SSL certificate.
Most cPanel-based hosts come with AutoSSL which generates a free Let’s Encrypt certificate. However, the problem is that when our traffic is proxied through Cloudflare, AutoSSL won’t be able to regenerate the certificate after it expires in 90 days. This means you will have to turn off Cloudflare’s proxy status temporarily (grey arrows), let the certificate regenerate in cPanel via AutoSSL, and then re-enable the proxy status (orange arrows) every 90 days.
To get around this problem, we create a Cloudflare Origin Certificate which lasts up to 15 years and install it on our server. This only needs to be done once and we’re good for the next 15 years.
Cloudflare’s Origin Certificates are only valid to connect Cloudflare with your host. They can’t be used anywhere else.
Select Origin Server tab under SSL/TLS in the Cloudflare panel, then Create Certificate.

In a separate window, in your website host, you will need to install the certificate.
The instructions that follow will assume you are using cPanel based hosting. in cPanel, go to SSL/TLS settings.

Cloudflare will present several options for your new certificate.
You can leave the Private Key Type to the default RSA (2048). The certificate will cover your main domain and all subdomains on the same shared document root.
If you have any subdomains with their own document root such as staging or dev, you will also need to add those subdomains in the Hostnames field individually.
For the validity, the 15 years default option is fine. You can then go ahead and Create the certificate.

Back in your web host, continue on to Manage SSL sites.

In this screen Cloudflare will generate your origin certificate and private keys. You will be copying the Origin Certificate and Private Key into cPanel.

In cPanel, select your main domain from the drop down and paste the certificate and private key respectively from Cloudflare. For the Certificate Authority Bundle field, make sure it is blank.
Click on OK in Cloudflare first and then Install Certificate in cPanel in that order.
If you get a red box with an error in cPanel, just try again after a few minutes as Cloudflare wasn’t done generating the certificate.

Once this is complete, Cloudflare will show that you successfully installed the origin certificate.

Back in cPanel, you will also get a screen showing that you successfully installed the origin certificate.
If you have other subdomains with their own document root, you will have to repeat the certificate generating and installation process above for each of them.

Increase Your Server SSL Security
With the Cloudflare Origin Certificate installed, we’re now ready to increase the security level for our server.
In the Cloudflare panel, click on the Overview tab below SSL/TLS. By default, Cloudflare will be set to Flexible encryption. Continue by going to Configure.

At the bottom, select Custom SSL Settings.

In the set of options, select Full (Strict) mode and then Save.

That’s it, you’re done!
Note that Cloudflare will show Full (strict) in the encryption mode with locks between the browser, Cloudflare and your origin server.
The origin server also has a badge to indicate that it has a valid certificate installed and the whole connection is end-to-end secured.

Testing Your Connection
Once you’ve successfully installed the Cloudflare origin certificate, you might get connection error to your website in your browser as follows:

This simply requires you to clear your browser’s cache and the connection will now be secure.

Congratulations! You’ve successfully setup Cloudflare to work with your website. Enjoy your newfound speed and security 🙂

2 comments
Amazing guide. Thanks for it.
Thank you very much! 😀