How To Configure Cloudflare For DNS And Email Hosted On VPS Server

Cloudflare

This tutorial will explain you how to configure Cloudflare for DNS, Email – MX, Webuzo control panel hosted on VPS server. If you are using shared hosting then it is very easy to setup Cloudflare because you can configure Cloudflare through cpanel. Then Cloudflare pulls the required information from your cpanel. But when you want to configure VPS hosting with Cloudflare then you need to mainly setup DNS manually.

Here I assume that you are running website on VPS server and you want to get advantages of using Cloudflare. I am going to configure VPS on Cloudflare free plan.

I am not going to tell you what is Cloudflare and what are the advantages of using it. But you may find useful resources on Cloudflare website.

I assume that you already have at least one website live on VPS server.

Prerequisites

Website’s domain name, VPS server’s public IP address

Configure VPS with Cloudflare

First step is to create a Cloudflare account by entering email address and password on registration page.

setup vps with cloudflare

Next step is to add your site:

setup vps with cloudflare

If you need to add multiple sites then you can click on Learn how link as shown in the image.

Now select plan according to your requirements. I am selecting Free plan.

setup vps and cloudflare

In the next screen you have to add DNS records if Cloudflare could not detect it automatically.

configure vps with cloudflare

In the above screen you have to add at least two records – A and CNAME.

A is used for IPv4 address and CNAME is used for your domain name.

There is another record AAAA that is used for IPv6 address. If you have IPv6 address then you can add.

Add A record as shown in the below image:

configure vps with cloudflare

Remember to replace example.com with your domain name in first box and IPv4 address 202.134.150.66 with your VPS server’s public IPv4 address in secod box. Keep the TTL Automatic. Then click on Add Record button.

Add CNAME as shown below in the image:

configure vps with cloudflare

Remember to replace domain name example.com with your domain name in second box. Click on Add Record button.

After adding A and CNAME your page should look to the similar image as shown below:

configure vps with cloudflare

Now if you are using different mail server apart from your hosting server then you don’t need to add MX records but if you are using hosting mail server (it’s actually not a mail server but hosting IP address and uses SMTP server for emails) then you need to add MX records otherwise you won’t be able to send/receive emails onto your mailbox.

We will hide the VPS server’s actual IP address from publicly exposed. In order to do that we need to add A record first as shown below:

configure vps with cloudflare

In the first box we have input a name called mail, you can give any name you want. Click on Add Record button.

Now create MX record that will point to your A record of mail. To create MX record on first box enter your domain name, on second box it will open a popup. So in the popup on first box enter mail, on second box enter 10 or any priority you want to give or accept default. Then click on Save.

configure vps with cloudflare

Finally click on Add Record button.

At the end of this step you have the following records:

configure vps with cloudflare

Click on the Continue button. In the next screen you will provided two name servers which you need to update on your domain registrar portal.

configure vps with cloudflare

That’s all. Hope you got idea how to configure VPS hosting with Cloudflare.

Now you will be able to see your website performance, analytics, DNS, caching and many more on your Cloudflare account.

Next time onward you need to login to your account using the email and password you entered during registration process.

Now you will be able to access your mailbox without any issues. You will be able to send and receive emails using your mail address that uses website’s domain.

If you are using Webuzo control panel then you will be able to access this control panel on ports 2002/2004 without any issues.

Leave a Reply

Your email address will not be published. Required fields are marked *