Cloudflare Setup: A Beginner's Guide
Cloudflare is a service that sits "between" your server and your users. It protects your site from hackers, hides your real IP address, and significantly speeds up page loading.
Why do you need Cloudflare?β
- Free SSL: Your site will work over the secure protocol
https://. - DDoS Protection: Deflect bot attacks with one click.
- DNS Hosting: The fastest domain record management in the world.
Part 1: Creating an Accountβ
- Sign Up: Go to dash.cloudflare.com/sign-up.
- Email and Password: Enter your details and confirm your email (you'll receive an email with a link).
- Login: Access the control panel.
Part 2: Adding Your Domainβ
- In the control panel, click Add a Site.
- Enter your domain name (e.g.,
example.com) withouthttp://. Click Add site. - Select a Plan: Scroll down and choose the Free plan ($0/month). Click Continue.
Part 3: Setting up DNS (The Most Important Step)β
Cloudflare will scan your current domain records.
- Check the list of records. You should typically have A records (pointing to your server's IP) and CNAME records (e.g., for
www). - Click Continue.
- Changing Nameservers (NS): Cloudflare will provide you with two addresses (e.g.,
amy.ns.cloudflare.comandbob.ns.cloudflare.com). - At your registrar: You need to log into your account where you bought the domain (Reg.ru, Namecheap, GoDaddy, etc.) and replace the current NS servers with the ones Cloudflare gave you.
Updating NS servers on the internet can take anywhere from 1 to 24 hours. During this time, the site may be temporarily unavailable.
Part 4: Security and SSL Settingsβ
After your domain is verified (you'll receive an email "Status: Active"), do the following:
1. SSL/TLS Modeβ
Go to SSL/TLS -> Overview:
- Select Full or Full (Strict) mode. This ensures full traffic encryption.
2. Always Use HTTPSβ
Go to SSL/TLS -> Edge Certificates:
- Enable the Always Use HTTPS toggle. Now users will always be redirected to the secure version of the site.
3. "Under Attack Mode"β
If you see suspicious traffic to your site, enable the Under Attack Mode toggle on the domain's main page. Users will see a browser check for 5 seconds.
Summary: What does this give you?β
Now your real Hetzner server IP is hidden behind Cloudflare's "cloud."
- If someone tries to attack your domain, Cloudflare will take the hit.
- Your server will use fewer resources as Cloudflare takes on part of the load.
You can check if protection is working on who.is β in the Nameservers field, Cloudflare servers should be listed.