This is a very basic tutorial useful for beginners to connect their VPS/cloud servers with the Internet through fastest DNS hosting service by Cloudflare.
Just heard it for the very first time? Let me explain it in very short sentences.
Cloudflare is well-known for free CDN services and low-latency DNS servers.
You can use it as a DNS server only or both DNS and CDN.
What is CDN? Content Delivery Network is a set of server infrastructures acting as edge networks. These infrastructures reside globally in many countries.
Using a CDN service for your websites allows you to provide content that is fast, safe, and reliable. CDN networks eliminate delays and improve the experience for users by serving web content as close as possible.
What are DNS servers? The Domain Name System is the phonebook of the Internet.
Hence, DNS servers are a set of computers serving the phonebook. You need it to make your websites accessible through the Internet by just typing its domain name.
Without a DNS server you will need to access your website using your server’s IP address instead.
Cloudflare offers both services in addition to other cutting edge technology to improve and secure websites. You can find out more about Cloudflare here.
How to Use Cloudflare?
Step 1 – Visit Cloudflare.com and click Sign Up (or click Log In if you already have one). Enter your email address, define your password, and click Create Account button.
Step 2 – Once you logged in, click Add Site menu.
Step 3 – Enter your domain name then hit Add Site button.
Step 4 – Choose the FREE plan then click Confirm Plan button. Of course, you are welcome to go Pro.
Step 5 – Cloudflare will perform a quick DNS scan to find existing records (if any).
Step 6 – All existing DNS records will be displayed in the next page. In my example, I don’t have any DNS records just yet. Click Add Record button to start adding entries.
Step 7 – Let’s add a record. Choose DNS record Type, define record Name, enter your server IP address, turn off/on Cloudflare Proxy, then click Save button.
Please note: You must have at least one A record.
A tip: You can simply input @ to the Name field to point your DNS record to the main domain name.
Step 8 – In my example, I put 2 A records. One for the main domain and another for my server hostname. I also have one CNAME record for www. Click Continue once done editing.
Step 9 – You’ll get the Nameservers displayed on the next page. Use both NS1 and NS2.
Step 10 – Log in to management panel of your Domain registrar. Change the existing Nameservers to Cloudflare’s. Here’s an example from Namesilo.
Changing Nameservers takes time.
Step 11 – Go back to Cloudflare. You’ll get into a Quick Start Guide. You can skip this stage but we really suggest you go with the process.
Step 12 – Enable free SSL with Cloudflare. Choose Flexible which is the suitable setting for most users.
Step 13 – You can opt in to always use HTTPS protocol if you want.
Step 14 – Next, despite optional, you can also enable Auto Minify options for JS, CSS and HTML files. This saves your server resource by not using any other web-based plugin to minify those scripts.
Step 15 – Brotli compression is better than Gzip. You can enable it if you enabled HTTPS option.
Step 16 – Click Finish once done.
Congratulation, you have just added your site to Cloudflare service.
How to Use Cloudflare as DNS Server Only
As you can see in Step 7 and Step 8 above, you can disable full Cloudflare service by switching off the cloud icon.
With the cloud icon being switched off, that means you lose the benefit of caching, CDN, and security features. DNS hosting is the only feature you’ll get.
Prefer to use your own Nameservers which is cooler? Read our previous guide on how to set up your own Nameservers.
Leave a comment below if you have questions on this topic.