StarDomain
Tutorials & Guides

How to Set Up Cloudflare for Your Website: Step-by-Step

Cloudflare provides free CDN, DDoS protection, and performance optimization. Here is how to set it up correctly.

E
Editorial Team
March 27, 2026
7 min read2 views

What is Cloudflare?

Cloudflare is a global network that sits between your visitors and your web server, providing CDN caching, DDoS protection, SSL, and performance optimization — with a generous free tier.

Setting Up Cloudflare

Step 1: Create an Account

Visit cloudflare.com and sign up. The free plan covers most needs.

Step 2: Add Your Site

Enter your domain name. Cloudflare scans your existing DNS records automatically.

Step 3: Review DNS Records

Verify all DNS records were imported correctly. Key records:

  • A record — points to your server IP
  • CNAME — for www and subdomains
  • MX records — for email delivery
Warning

Ensure MX records are NOT proxied (orange cloud). Email must connect directly to your server.

Step 4: Change Nameservers

Update your domain's nameservers at your registrar to the Cloudflare-assigned nameservers. This typically takes 24-48 hours to propagate.

Step 5: Configure SSL

  • Set SSL mode to Full (Strict) if your origin has a valid SSL certificate
  • Enable Always Use HTTPS
  • Enable Automatic HTTPS Rewrites

Speed

  • Auto Minify: Enable for HTML, CSS, and JavaScript
  • Brotli: Enable
  • Early Hints: Enable
  • HTTP/3: Enable

Caching

  • Browser Cache TTL: 1 month
  • Always Online: Enable (shows cached pages when your server is down)

Security

  • Security Level: Medium
  • Bot Fight Mode: Enable
  • Challenge Passage: 30 minutes

Page Rules (3 free)

1. *yourdomain.com/wp-admin/* → Security Level: High, Cache Level: Bypass
2. *yourdomain.com/wp-login.php → Security Level: High
3. *yourdomain.com/*.jpg → Cache Level: Cache Everything, Edge TTL: 1 month

Common Issues

IssueSolution
Redirect loopSet SSL to Full (Strict), not Flexible
Email not workingEnsure MX records are DNS-only (gray cloud)
Admin login issuesWhitelist your IP in Firewall rules
Slow after enablingPurge cache, check page rules

Conclusion

Cloudflare is the easiest way to improve your website's security and performance. The free tier alone provides significant benefits. Set it up once and enjoy ongoing protection and speed improvements.

Share this article
E
Written by

Editorial Team

Our editorial team shares expert knowledge and practical insights to help you succeed online with hosting, domains, and web technology.