Performance & Maintenance

How to Install and Configure Cloudflare CDN on Your Website

A step-by-step guide to connecting your website to Cloudflare CDN: from creating your account to setting up caching rules and essential security settings.

Smartphone displaying stock market data on papers with financial charts.

Installing Cloudflare CDN on your website comes down to three steps: create an account, point your DNS to Cloudflare, and enable caching and security options. In under 30 minutes, your site can serve content from more than 330 nodes worldwide.

Cloudflare is the world's most widely used CDN, and its free plan already includes global CDN, basic DDoS protection, and automatic SSL. If your site loads slowly for visitors outside your city — or if you want to reduce load on your origin server — Cloudflare is the logical first step.

What Cloudflare Actually Does for Your Site

Cloudflare acts as a reverse proxy between your visitors and your origin server. When someone visits your site:

  1. The request hits the Cloudflare node closest to the user.
  2. If the resource is cached, Cloudflare delivers it from that node without touching your server.
  3. If it's not cached, Cloudflare fetches it from your server, stores it, and delivers it.

The result: lower response times for users everywhere, fewer requests reaching your origin server, and automatic protection against network attacks. For sites with visitors spread across multiple regions, the difference is immediate.

In addition to the CDN, Cloudflare's free plan includes: basic DDoS protection, a limited Web Application Firewall (WAF), automatic SSL/TLS, and basic traffic analytics.

Step 1 — Create Your Account and Add Your Domain

Start at cloudflare.com. If you don't have an account yet, registration is free with an email and password.

  1. Log in to your Cloudflare dashboard and click "Add a domain".
  2. Enter your domain (e.g., yoursite.com) and choose a plan. The Free plan is enough to get started.
  3. Cloudflare will automatically scan your current DNS records. Review the list — all your existing A, CNAME, MX, and TXT records should appear.
  4. Manually add any missing records before continuing. A missing DNS record can break your email or subdomains.

Pro tip: before changing nameservers, document all your current DNS records in a text file. If something breaks during the migration, you'll have the exact reference to restore.

Step 2 — Update Nameservers at Your Domain Registrar

Once your DNS records are imported, Cloudflare will give you two nameservers (e.g., nina.ns.cloudflare.com and bob.ns.cloudflare.com). You need to set these at your domain registrar.

Steps for common registrars

  • GoDaddy: My Products → Domain → Manage → Nameservers → Change → Enter my own nameservers.
  • Namecheap: Domain List → Manage → Nameservers → Custom DNS.
  • cPanel / WHM: if the domain is registered with the same hosting provider, go to "Zone Editor" or contact support to change nameservers.

DNS propagation can take anywhere from 5 minutes to 48 hours, though it usually completes within 2 hours. Track progress with whatsmydns.net.

Cloudflare will send you a confirmation email once it detects the nameservers are active.

Step 3 — Configure SSL, Cache, and Speed Settings

Once active, the Cloudflare dashboard has dozens of options. Start with these:

SSL/TLS

Go to SSL/TLS → Overview and choose the right mode:

  • Flexible: Cloudflare connects to your server over HTTP. Easy to set up, but leaves the Cloudflare-to-server leg unencrypted. Use only if your server has no SSL certificate.
  • Full: Cloudflare connects to your server over HTTPS but accepts any certificate (including self-signed). Recommended if you already have SSL on your server.
  • Full (Strict): requires a valid SSL certificate on your server (Let's Encrypt or similar). The most secure option and the one recommended for production sites.

Always enable "Always Use HTTPS" under SSL/TLS → Edge Certificates to automatically redirect all HTTP traffic to HTTPS.

Caching

Go to Caching → Configuration:

  • Caching Level → Standard: caches static files (images, CSS, JS) based on server headers. This is your starting point.
  • Browser Cache TTL: sets how long browsers store resources locally. For static assets, 1 year is reasonable. For dynamic HTML, let your server's headers control it.
  • Purge Cache: after updating your site, use "Purge Everything" so Cloudflare serves the updated version. You can also purge specific URLs.

Speed

Under Speed → Optimization:

  • Enable Auto Minify for HTML, CSS, and JavaScript (reduces file size without touching your server).
  • Enable Brotli for more efficient compression than Gzip.
  • Consider enabling Early Hints (HTTP 103) to speed up the loading of critical resources.

Step 4 — Set Up Basic Security Rules

Cloudflare is also a security layer. These settings are the most important to configure first:

Setting Location Recommended value
Security Level Security → Settings Medium (blocks known bad bots)
Bot Fight Mode Security → Bots Enabled (Free plan)
HSTS SSL/TLS → Edge Certificates Enable (max-age 6 months or more)
Hotlink Protection Scrape Shield Enabled (prevents bandwidth theft)
Email Address Obfuscation Scrape Shield Enabled (reduces email scraping)

For WordPress sites, add a custom firewall rule (Security → WAF → Custom Rules) to block direct access to /wp-login.php from IPs other than your own. This eliminates roughly 90% of brute-force login attempts.

If you want expert help getting the most out of Cloudflare and your hosting setup, the team at elenlace.com offers professional CDN configuration and ongoing management.

Verification: Is Cloudflare Active and Working?

To confirm that traffic is flowing through Cloudflare:

  • Open browser DevTools (F12) → Network tab → select any static resource → check the response headers. You should see cf-cache-status: HIT or MISS, and server: cloudflare.
  • Use dnschecker.org to confirm that the nameservers are pointing to Cloudflare.
  • Check the Analytics tab in your Cloudflare dashboard; the first requests will appear within minutes.

For a broader look at web performance strategies, browse the performance articles section of this blog.

Key Takeaways

  • Cloudflare CDN is installed by changing your domain's nameservers — no server access or software installation required.
  • Document your current DNS records before migrating so you can restore them if something breaks.
  • SSL mode "Full (Strict)" is the most secure; it requires a valid certificate on your origin server.
  • Always enable "Always Use HTTPS" and HSTS to protect your users' traffic.
  • Cloudflare's caching works well on default settings; tune TTL based on your content type.
  • Add firewall rules to protect sensitive paths like the WordPress login page.

Would you rather have someone configure it correctly from the start? At elenlace.com we handle Cloudflare installation and configuration so your site is faster and more secure — without you touching a single setting.

FAQ

Is Cloudflare CDN really free?

Yes. The Free plan includes global CDN, basic DDoS protection, automatic SSL, and basic analytics at no cost. Paid plans (Pro, Business, Enterprise) add an advanced WAF, more Page Rules, priority support, and features like Image Resizing and Workers. For most small and mid-sized sites, the free plan is more than enough.

Will Cloudflare affect my email?

No, as long as MX records are imported correctly. Cloudflare only proxies web traffic (A/CNAME records with the orange cloud icon enabled). MX records are kept in DNS-only mode (gray cloud icon) and your email continues to work normally. Verify that all your MX, SPF, DKIM, and DMARC records are present before changing nameservers.

Can I use Cloudflare with shared hosting?

Yes — and in fact that's where you'll notice the biggest improvement. On shared hosting, server resources are limited; Cloudflare reduces the number of requests hitting the origin, which relieves load on your plan. Just make sure to set the correct SSL mode based on what certificate your hosting provider offers.

How do I prevent Cloudflare from caching dynamic pages like the cart or admin panel?

By default, Cloudflare does not cache dynamic HTML — only static assets. However, if you enable "Cache Everything" in a Page Rule, you must exclude paths like /wp-admin/*, /cart/*, /checkout/*, and /my-account/* with cache bypass rules for those specific URLs.

Useful resources

Other providers and guides worth comparing:

← All