How to use Cloudflare for DNS, cache and protection
Updated 7/20/2026
Cloudflare is a free service that sits in front of your site: it manages DNS, serves content from a global cache and adds protection. Here is how to use it.
1. Add the domain to Cloudflare
You create an account, add the domain, and Cloudflare imports the existing DNS records.
2. Change the nameservers at the registrar
Cloudflare gives you two nameservers. You set them at the domain registrar (where you bought the domain). After propagation, DNS is managed by Cloudflare.
3. Proxy mode
For each record, you can enable the proxy (the orange cloud):
- Proxied: traffic goes through Cloudflare, which hides the server IP and adds cache and protection.
- DNS only: Cloudflare just resolves the name, traffic goes straight to the server (needed for services like SSH or email).
4. Cache and speed
Cloudflare keeps static files (images, CSS, JS) in data centers around the world, so visitors get them fast, also reducing your server's traffic.
Note
Even with Cloudflare in front, your server needs its own HTTPS, see Free SSL certificate, and Nginx optimizations.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
Email DNS records: SPF, DKIM and DMARC
Set up SPF, DKIM and DMARC so your emails reach the inbox, not spam.
Updated 7/20/2026Networking & DNSWhat is a CDN and when you need one
A CDN delivers content close to visitors, faster. Here is how it works and when it is worth it.
Updated 7/20/2026Networking & DNSHow to connect two servers over a private network
Link your servers through an encrypted WireGuard tunnel, so they communicate securely without exposing services to the internet.
Updated 7/20/2026