Cloudflare CDN Setup Guide for Beginners: Speed Up Your Website for Free in 2026
Cloudflare is the world's most popular Content Delivery Network and DNS provider. Its free plan includes CDN caching, DDoS protection, free SSL certificates, and a global DNS network with 320+ data center locations. Whether you run a personal blog, a SaaS application, or an e-commerce store, Cloudflare can cut your page load times in half and block malicious traffic β at no cost. This guide covers the complete setup process from account creation to advanced optimization.
Why Cloudflare in 2026
The CDN and web infrastructure market has several players. Here is how Cloudflare compares.
| Provider | Free Plan | CDN | DNS | DDoS Protection | SSL | Edge Network |
|---|---|---|---|---|---|---|
| Cloudflare | Yes (generous) | Yes | Yes | Yes (unlimited) | Yes (free) | 320+ cities |
| AWS CloudFront | No (pay per use) | Yes | Via Route 53 | Via Shield | Yes (paid) | 50+ locations |
| Fastly | No (pay per use) | Yes | No | Yes (paid) | Yes (paid) | 80+ locations |
| Akamai | No (enterprise) | Yes | Yes | Yes (enterprise) | Yes (paid) | 1000+ locations |
| Bunny.net | No ($0.01/GB) | Yes | Yes | Yes | Yes (paid) | 100+ locations |
| KeyCDN | No ($0.04/GB) | Yes | No | No | Yes (paid) | 35+ locations |
Cloudflare wins on the free plan value. No other provider offers full CDN, DNS, DDoS protection, and SSL at $0. The trade-off is that advanced features like image optimization, firewall rules, and rate limiting require paid plans.
Cloudflare Pricing in 2026
| Plan | Monthly Cost | Key Features | Best For |
|---|---|---|---|
| Free | $0 | CDN, DNS, SSL, basic DDoS, caching | Personal sites, blogs, small projects |
| Pro | $25 | Image optimization, enhanced DDoS, WAF rules | Small businesses, growing sites |
| Business | $250 | Custom SSL, advanced WAF, image resizing | E-commerce, mid-size companies |
| Enterprise | Custom | Custom SSL, Argo Smart Routing, 100% SLA | Large enterprises |
What You Get for Free
| Feature | Free Plan Limits |
|---|---|
| DNS records | 1,000 per zone |
| Page rules | 3 |
| Firewall rules | 5 |
| Cache rules | 10 |
| Workers | 100,000 requests/day |
| Bandwidth | Unlimited |
| SSL certificates | Unlimited (Universal SSL) |
| DDoS protection | Unlimited (unmetered) |
| Analytics | 30-day data retention |
For most personal sites and small businesses, the free plan covers everything you need.
Step 1: Create Your Cloudflare Account
- Go to cloudflare.com and click "Sign Up"
- Enter your email address and create a password
- Verify your email by clicking the confirmation link
- Log in to your Cloudflare dashboard
Add Your Website
- Click Add a Site on the dashboard home page
- Enter your domain name (e.g., example.com)
- Select the Free plan (scroll down past paid plans)
- Cloudflare scans your existing DNS records
Step 2: Migrate Your DNS
DNS migration is the most critical step. Your DNS records tell the internet where to find your website, email, and other services.
Reviewing DNS Records
After Cloudflare scans your domain, it displays your existing DNS records. Verify each one:
| Record Type | Name | Content | Proxied? | Purpose |
|---|---|---|---|---|
| A | @ | 192.168.1.1 | Yes | Root domain β server IP |
| A | www | 192.168.1.1 | Yes | www subdomain β server IP |
| CNAME | blog | hostname.com | Yes | Blog subdomain |
| MX | @ | mail.example.com | No | Email routing |
| TXT | @ | v=spf1 include:_spf... | No | SPF email authentication |
| TXT | _dmarc | v=DMARC1; p=quarantine | No | DMARC email authentication |
Key DNS Rules
| Rule | Explanation |
|---|---|
| Proxy A/AAAA/CNAME records | Orange cloud (proxied) for web traffic |
| Do NOT proxy MX records | Gray cloud (DNS only) for email |
| Do NOT proxy TXT records | Gray cloud for SPF, DKIM, DMARC |
| Do NOT proxy FTP records | Gray cloud for FTP access |
| Proxy API subdomains | If your API is web-accessible, proxy it |
Understanding the Orange Cloud
The orange cloud icon next to a DNS record means Cloudflare proxies traffic through its CDN:
| Setting | Cloud Color | What It Does |
|---|---|---|
| Proxied (orange cloud) | Orange | Traffic goes through Cloudflare CDN, hides your server IP |
| DNS only (gray cloud) | Gray | Cloudflare only resolves DNS, traffic goes directly to your server |
Rule of thumb: Orange cloud for all web traffic (HTTP/HTTPS). Gray cloud for email, FTP, SSH, and other non-web protocols.
Change Your Nameservers
Cloudflare will give you two nameservers to replace your current ones:
- Copy the two nameservers Cloudflare provides (e.g.,
ada.ns.cloudflare.comandbob.ns.cloudflare.com) - Log in to your domain registrar (GoDaddy, Namecheap, Google Domains, etc.)
- Find the DNS or Nameserver settings for your domain
- Replace the existing nameservers with Cloudflare's nameservers
- Save changes
Nameserver Change by Registrar
| Registrar | Where to Change Nameservers | Time to Propagate |
|---|---|---|
| Namecheap | Domain List > Manage > Nameservers | 1-24 hours |
| GoDaddy | Domain Settings > Manage DNS > Nameservers | 1-48 hours |
| Google Domains | DNS > Custom name servers | 1-24 hours |
| Cloudflare Registrar | Automatic (if domain registered with CF) | Instant |
| AWS Route 53 | Hosted Zone > NS record | 1-48 hours |
| Dynadot | Domains > Name Servers | 1-24 hours |
Verifying DNS Propagation
After changing nameservers, check propagation:
- Use whatsmydns.net or diggui.com
- Enter your domain name
- Check if results show Cloudflare's IP addresses (104.x.x.x range)
- Full propagation typically takes 1-48 hours
- Cloudflare sends an email when your domain is active
Step 3: Configure SSL/TLS
SSL/TLS encrypts traffic between visitors and Cloudflare. This is one of the most important security features.
SSL/TLS Encryption Modes
| Mode | How It Works | Recommended For |
|---|---|---|
| Off | No encryption | Never use this |
| Flexible | CF β Visitor: encrypted, CF β Origin: not encrypted | Origin without SSL |
| Full | CF β Visitor: encrypted, CF β Origin: encrypted (self-signed OK) | Self-signed cert on origin |
| Full (Strict) | CF β Visitor: encrypted, CF β Origin: encrypted (valid cert) | Production (recommended) |
Setting Up SSL
- Go to SSL/TLS in the left sidebar
- Under Overview, select Full (Strict) if your server has an SSL certificate
- If your server does not have SSL, select Flexible temporarily
- Under Edge Certificates, enable:
- Always Use HTTPS: Redirects HTTP to HTTPS
- HTTP Strict Transport Security (HSTS): Forces browsers to use HTTPS
- Automatic HTTPS Rewrites: Fixes mixed content warnings
- Minimum TLS Version: Set to 1.2
Getting a Free Origin Certificate
If your server does not have an SSL certificate, Cloudflare provides free origin certificates:
- Go to SSL/TLS > Origin Server
- Click Create Certificate
- Select Let Cloudflare generate a private key
- Choose RSA (2048) or ECC
- Set hostname to
*.example.com, example.com - Set validity to 15 years
- Click Create
- Copy the certificate and private key
- Install on your server (nginx, Apache, etc.)
Installing Origin Certificate on Nginx
server {
listen 443 ssl;
server_name example.com;
ssl_certificate /path/to/cloudflare-cert.pem;
ssl_certificate_key /path/to/cloudflare-key.pem;
# ... rest of your server config
}
Step 4: Configure Caching
Caching is what makes Cloudflare a CDN. It stores copies of your static files at edge locations worldwide.
Default Cache Behavior
Cloudflare caches certain file extensions by default:
| Cached by Default | NOT Cached by Default |
|---|---|
| CSS files (.css) | HTML pages |
| JavaScript (.js) | JSON responses |
| Images (.jpg, .png, .gif, .webp) | API responses |
| Fonts (.woff, .woff2, .ttf) | Cookies |
| Documents (.pdf) | Dynamic content |
Cache Level Settings
Go to Caching > Configuration to set cache levels:
| Cache Level | What It Does | Recommended |
|---|---|---|
| No Query String | Only cache files without query strings | Static assets |
| Ignore Query String | Cache all files regardless of query strings | Rarely useful |
| Standard | Cache files, treat different query strings as different files | Default (recommended) |
Browser Cache TTL
Set how long visitors' browsers cache files:
| Setting | Browser Cache Duration | Recommended For |
|---|---|---|
| 4 hours | Lightweight caching | News sites, frequently updated |
| 12 hours | Medium caching | Blogs with daily updates |
| 1 day | Standard caching | Most websites |
| 1 month | Long caching | Static assets (CSS, JS, images) |
Page Rules for Caching
Page rules let you customize caching behavior for specific URLs. You get 3 free page rules.
Example 1: Cache Everything on a Landing Page
| Setting | Value |
|---|---|
| URL | example.com/landing-page |
| Cache Level | Cache Everything |
| Edge Cache TTL | 1 hour |
| Browser Cache TTL | 1 hour |
Example 2: Bypass Cache for Admin Panel
| Setting | Value |
|---|---|
| URL | example.com/admin/* |
| Cache Level | Bypass |
| Security Level | High |
Example 3: Cache Static Assets for 1 Month
| Setting | Value |
|---|---|
| URL | example.com/assets/* |
| Cache Level | Cache Everything |
| Edge Cache TTL | 1 month |
| Browser Cache TTL | 1 month |
Cache Rules (New System)
Cloudflare is transitioning from Page Rules to Cache Rules, which offer more granular control:
- Go to Cache > Cache Rules
- Click Create rule
- Set the matching condition (e.g., URL path starts with
/static/) - Set the cache behavior (Cache eligible, Edge TTL)
Step 5: Security Settings
DDoS Protection
Cloudflare's DDoS protection is automatic and free. It activates when it detects attack patterns.
- Go to Security > DDoS
- View the DDoS attack dashboard
- Enable High sensitivity for your site
- DDoS protection works automatically β no configuration needed
Firewall (WAF) Rules
The free plan includes 5 firewall rules. Use them to block malicious traffic:
Example 1: Block Specific Countries
| Setting | Value |
|---|---|
| Rule name | Block unwanted countries |
| Field | IP Source Country |
| Operator | is in |
| Value | Select countries to block |
| Action | Block |
Example 2: Challenge Suspicious User Agents
| Setting | Value |
|---|---|
| Rule name | Challenge bots |
| Field | User Agent |
| Operator | contains |
| Value | bot, crawler, scraper |
| Action | Managed Challenge |
Example 3: Protect Login Page
| Setting | Value |
|---|---|
| Rule name | Rate limit login |
| Field | URI Path |
| Operator | equals |
| Value | /wp-login.php |
| Action | Rate Limit (10 requests per 10 seconds) |
Bot Fight Mode
- Go to Security > Bots
- Enable Bot Fight Mode (free)
- This blocks automated bots from scraping your site
- Cloudflare maintains a list of known bot signatures
Security Level
- Go to Security > Settings
- Set Security Level:
- Off: No challenge pages
- Essentially Off: Minimal challenges
- Low: Challenge suspicious visitors
- Medium: Default, balanced
- High: Challenge more aggressively
- I'm Under Attack: Challenge every visitor (emergency use only)
Rate Limiting Rules
The free plan includes rate limiting:
- Go to Security > WAF > Rate limiting rules
- Click Create rule
- Set the matching condition (URL path)
- Set the threshold (e.g., 100 requests per 10 seconds)
- Set the action (Block for 10 minutes)
Step 6: Performance Optimization
Auto Minify
- Go to Speed > Optimization
- Under Auto Minify, enable:
- JavaScript
- CSS
- HTML
This removes whitespace, comments, and unnecessary characters from your files.
Brotli Compression
- Go to Speed > Optimization
- Under Compression, enable Brotli
- Brotli compresses files 15-20% smaller than Gzip
Early Hints
- Go to Speed > Optimization
- Enable Early Hints
- Cloudflare sends
103 Early Hintsresponses to pre-load critical resources before the full page loads
HTTP/3 and QUIC
- Go to Network
- Enable HTTP/3 (with QUIC)
- Enable 0-RTT Connection Resumption
- HTTP/3 reduces connection latency by 30-50%
Performance Feature Comparison
| Feature | Free | Pro | Business | Impact on Speed |
|---|---|---|---|---|
| Auto Minify | Yes | Yes | Yes | -10% file size |
| Brotli | Yes | Yes | Yes | -15-20% transfer size |
| HTTP/3 | Yes | Yes | Yes | -30-50% connection latency |
| Early Hints | Yes | Yes | Yes | -200ms TTFB |
| Polish (image optimization) | No | Yes | Yes | -40-70% image size |
| Mirage (mobile images) | No | Yes | Yes | -50% mobile image size |
| Argo Smart Routing | No | No | Add-on | -30% TTFB globally |
| Tiered Cache | Yes | Yes | Yes | -50% origin requests |
Step 7: Set Up Cloudflare Workers (Free Tier)
Workers let you run JavaScript at the edge β no server required.
Free Tier Limits
| Metric | Limit |
|---|---|
| Requests | 100,000 per day |
| CPU time | 10ms per request |
| Scripts | 10 |
| KV namespaces | 10 |
| KV reads | 100,000 per day |
| KV writes | 1,000 per day |
Creating a Simple Worker
- Go to Workers & Pages in the left sidebar
- Click Create Worker
- Name your worker
- Add this code:
export default {
async fetch(request, env, ctx) {
const url = new URL(request.url);
// Add a custom header to all responses
const response = await fetch(request);
const newResponse = new Response(response.body, response);
newResponse.headers.set('X-Custom-Header', 'Powered by Cloudflare');
return newResponse;
},
};
- Click Deploy
- Your worker is now running at
your-worker.your-subdomain.workers.dev
Worker Use Cases
| Use Case | What It Does | Complexity |
|---|---|---|
| Custom headers | Add security or branding headers | Easy |
| A/B testing | Route traffic to different origins | Medium |
| Redirect rules | URL redirects without server config | Easy |
| API caching | Cache API responses at edge | Medium |
| Basic auth | Password-protect a page | Easy |
| Geo-blocking | Block by country | Easy |
| Rate limiting | Custom rate limiting logic | Medium |
Step 8: Analytics and Monitoring
Cloudflare provides detailed analytics on the free plan.
Available Metrics
| Metric | Where to Find It | What It Shows |
|---|---|---|
| Requests | Analytics > Traffic | Total requests, cached vs. uncached |
| Bandwidth | Analytics > Traffic | Bandwidth saved by caching |
| Threats | Analytics > Security | Blocked attacks, bot traffic |
| Page views | Analytics > Web Analytics | Unique visitors, page views |
| Cache ratio | Analytics > Caching | Percentage of requests served from cache |
| Response codes | Analytics > Traffic | HTTP status codes (200, 404, 500, etc.) |
| SSL/TLS | Analytics > SSL/TLS | SSL handshake success rate |
Web Analytics
Cloudflare Web Analytics is a privacy-focused alternative to Google Analytics:
- Go to Analytics & Logs > Web Analytics
- Click Add a site
- Enter your domain
- Cloudflare provides a JavaScript snippet
- Add it to your website's
<head>section
| Feature | Cloudflare Analytics | Google Analytics |
|---|---|---|
| Cost | Free | Free (GA4) |
| Privacy | No cookies, no PII | Uses cookies |
| Script size | <1 KB | 40+ KB |
| Page views | Yes | Yes |
| User journeys | No | Yes |
| Conversions | No | Yes |
| Real-time | Yes | Yes |
Step 9: Advanced Features
Cloudflare Pages
Host static websites for free:
- Go to Workers & Pages
- Click Create > Pages
- Connect your GitHub/GitLab repository
- Set build command (e.g.,
npm run build) - Set output directory (e.g.,
dist) - Click Save and Deploy
| Feature | Cloudflare Pages | Netlify | Vercel |
|---|---|---|---|
| Free builds | 500/month | 300/month | 6000 min/month |
| Bandwidth | Unlimited | 100 GB | 100 GB |
| Custom domains | Unlimited | 1 (free) | 1 (free) |
| Edge functions | Yes | Yes | Yes |
| Price | $0 | $0-$19/mo | $0-$20/mo |
Cloudflare DNS Features
| Feature | How to Enable | Benefit |
|---|---|---|
| DNSSEC | DNS > Settings > Enable DNSSEC | Prevents DNS spoofing |
| CNAME Flattening | DNS > Settings > Flattening | Root domain as CNAME |
| Subdomain Setup | DNS > Add record | Create subdomains |
| Custom nameservers | Enterprise only | Branded nameservers |
Step 10: Troubleshooting Common Issues
Issue 1: Website Not Loading After Migration
| Cause | Solution |
|---|---|
| DNS records missing | Compare with original DNS, add missing records |
| SSL mode mismatch | Switch to Flexible temporarily, then fix origin cert |
| Nameservers not updated | Verify with registrar, wait for propagation |
| Firewall blocking traffic | Check WAF rules, check security level |
Issue 2: Mixed Content Warnings
Mixed content occurs when HTTPS pages load HTTP resources:
- Enable Automatic HTTPS Rewrites in SSL/TLS > Edge Certificates
- Enable Always Use HTTPS
- Update your website's internal links to use HTTPS
- Check for hardcoded HTTP URLs in your CSS/JS
Issue 3: High Cache Miss Rate
If your cache hit ratio is low:
| Fix | How |
|---|---|
| Add Cache Everything page rule | For static HTML pages |
| Set longer Edge TTL | For rarely changed content |
| Use Cache Rules with matching | For specific URL patterns |
| Purge cache after updates | Go to Caching > Configuration > Purge Everything |
| Enable Tiered Cache | Network > Tiered Cache |
Issue 4: Email Not Working After Migration
Email issues are almost always caused by DNS record problems:
| Email Issue | Likely Cause | Solution |
|---|---|---|
| Can't send email | MX record not added | Add MX record, set to DNS only (gray cloud) |
| Can't receive email | MX record proxied | Change MX record to DNS only |
| Email goes to spam | SPF/DKIM not configured | Add SPF and DKIM TXT records |
| Webmail not accessible | A record missing | Add A record for mail subdomain, DNS only |
Cloudflare for Different Website Types
For WordPress Sites
- Install the Cloudflare WordPress plugin
- The plugin helps with automatic cache purging
- Set Page Rule: Bypass cache for /wp-admin/*
- Set Page Rule: Bypass cache for /wp-login.php
- Enable Auto Minify for CSS, JS, and HTML
For Next.js / React Sites
- Use Cloudflare Pages for hosting (free)
- Set up custom domain in Pages settings
- Enable HTTP/3 and Brotli compression
- Use Cache Rules for static assets in /_next/static/
- Set Edge TTL to 1 month for /_next/static/* files
For E-commerce Sites
- Bypass cache for cart, checkout, and account pages
- Enable rate limiting on login and registration endpoints
- Set up firewall rules to block suspicious traffic
- Enable Bot Fight Mode to prevent scraping
- Consider Pro plan for Polish (image optimization)
Cloudflare for Side Hustles and Small Businesses
| Use Case | Cloudflare Free Plan | Paid Alternative | Savings |
|---|---|---|---|
| CDN for blog | Free unlimited bandwidth | AWS CloudFront ~$50/mo | $600/year |
| DDoS protection | Free unlimited | AWS Shield ~$2,500/mo | $30,000/year |
| SSL certificate | Free Universal SSL | Paid SSL ~$50-200/year | $200/year |
| DNS hosting | Free 1,000 records | Route 53 ~$6/year | $6/year |
| Static site hosting | Free (Pages) | Netlify/Vercel ~$19/mo | $228/year |
| Workers | 100K req/day free | Lambda ~$20/mo | $240/year |
| Total annual savings | $31,474/year |
Action Checklist
- Create a Cloudflare account at cloudflare.com
- Add your domain and select the Free plan
- Review and verify all DNS records from the scan
- Ensure web traffic records are proxied (orange cloud)
- Ensure email records (MX, TXT) are DNS only (gray cloud)
- Copy the two Cloudflare nameservers
- Update nameservers at your domain registrar
- Wait for DNS propagation (check with whatsmydns.net)
- Set SSL/TLS mode to Full (Strict) or Flexible
- Enable Always Use HTTPS
- Enable Automatic HTTPS Rewrites
- Set Minimum TLS Version to 1.2
- Generate and install an Origin Certificate (if needed)
- Set Cache Level to Standard
- Set Browser Cache TTL appropriately
- Create 3 Page Rules (cache static, bypass admin, cache assets)
- Enable Auto Minify for JS, CSS, and HTML
- Enable Brotli compression
- Enable HTTP/3 (QUIC)
- Enable Early Hints
- Enable Bot Fight Mode
- Set Security Level to Medium
- Create firewall rules (block countries, challenge bots, protect login)
- Set up rate limiting on critical endpoints
- Enable Cloudflare Web Analytics
- Check analytics dashboard after 24 hours for cache ratio
- Enable DNSSEC for added security
- Test your website speed with PageSpeed Insights
- Consider upgrading to Pro ($25/mo) for Polish image optimization
Realistic Performance Gains
| Metric | Without Cloudflare | With Cloudflare Free | Improvement |
|---|---|---|---|
| TTFB (Time to First Byte) | 400-800ms | 50-150ms | -75% |
| Global page load time | 3-5 seconds | 1-2 seconds | -60% |
| Cache hit ratio | 0% | 65-85% | Significant |
| Bandwidth usage | 100% | 15-35% of original | -65% to -85% |
| DDoS resilience | Low | High | Significant |
| SSL cost | $50-200/year | $0 | -100% |
| DNS resolution time | 50-200ms | 5-20ms | -90% |
Final Word
Cloudflare's free plan is the best deal in web infrastructure. For $0, you get a global CDN with unlimited bandwidth, DDoS protection, free SSL, a fast DNS network, and edge computing with Workers. The setup takes 30-60 minutes: create an account, add your domain, update nameservers, configure SSL, set up caching rules, and enable performance features. The performance impact is immediate β most sites see a 50-75% reduction in page load times within an hour of setup. For side hustles and small businesses, Cloudflare eliminates the need to pay for a CDN, SSL certificates, DDoS protection, and DNS hosting separately, saving thousands of dollars per year. Start with the free plan, configure all the settings in the checklist, and upgrade to Pro only if you need image optimization or advanced WAF rules.
More guides: bsynet.cc