Why Use Cloudflare with cPanel & WHM?

Cloudflare is a powerful CDN (Content Delivery Network) that improves website speed, security, and uptime. When properly configured with cPanel & WHM, Cloudflare can:

  • Reduce server load by caching static content.
  • Protect against DDoS attacks and malicious traffic.
  • Improve global page load speeds with distributed caching.
  • Enhance security with Web Application Firewall (WAF).

Step 1: Create and Configure a Cloudflare Account

  1. Go to Cloudflare’s website and sign up.
  2. Add your domain and allow Cloudflare to scan your DNS records.
  3. Select a plan (Free, Pro, or Business depending on your needs).
  4. Cloudflare will provide new nameservers. Update them in your domain registrar.

Step 2: Optimize Cloudflare Settings for cPanel Hosting

Enable Full Page Caching

  • Go to Cloudflare’s dashboard and enable Caching → Full Page Cache.
  • Set TTL (Time to Live) to reduce frequent requests to the origin server.

Enable Brotli Compression & Auto Minify

  • Go to Speed → Optimization.
  • Enable Brotli compression for faster delivery of HTML, CSS, and JS files.
  • Enable Auto Minify for JavaScript, CSS, and HTML.

Activate Cloudflare Web Application Firewall (WAF)

  • Enable WAF to protect against SQL injections and bot attacks.
  • Use Cloudflare’s OWASP rule set for enhanced security.

Set Up DNS Proxy for Faster Resolution

  • Ensure DNS records are set to Proxied (Orange Cloud) in Cloudflare.
  • Disable DNS proxy for mail and FTP records to avoid connection issues.

Step 3: Configure Cloudflare with WHM for Server-Wide Optimization

  1. Go to WHM and navigate to Networking Setup → Host Access Control.
  2. Allow Cloudflare’s IP ranges to ensure proper traffic filtering.
  3. Install mod_remoteip to preserve visitor IPs in Apache logs.

Step 4: Test and Monitor Performance

Need Expert Help with Cloudflare Setup?

For a fully optimized Cloudflare and cPanel setup, check out UnderHost’s Managed Hosting. Need support? Contact @CustomerPanel for assistance.