The shared server hosting scenario is different than the VPS or dedicated server. It is because on the VPS you need to manage most of the things by your self, like setting up of server OS and Cpanel or web control panel to manage the hosting space and web services.
Assuming that you already have set up the server and web project on your VPS server and now to add an extra layer of security you want to route your traffic through the Cloudflare firewall to save your server from DDOS attacks.
Here is the tutorial to set up / enable Cloudflare for the VPS servers, although the steps are the same for Sharing hosting servers too.
- First of go to Cloudflare.com and create an account. (note: If you already have added your website to Cloudflare the move to step )
- Click on Add site button.
- Type the website domain name you want to add to CloudFlare.
- Click on Add site button.
- Select the Free Plan. In case you want some better security feature you can opt for paid plans.
- Click on Next and Copy the Cloudflare name server and paste it on NotePad. Becuase we need to update our domain naming server with the Cloudflare’s.
- For this either you can go for the next step to get an idea how to update naming servers or just click on “I need help changing my nameservers” given just below the Cloudflare Nameservers web page. A drop-down box will appear with different Domain registrars such as Godaddy, NameCheap, Enom, Network solutions and other. Select your registrar, if its name is not in the list then choose the Other. And you will get a tutorial on how to update nameservers.
- Here we will show how to update naming servers on Godaddy, the process is almost same for other Domain registrars too.
- Step 1: Login to your GoDaddy dashboard and go to My Product Section where all your purchased product including domain and hosting servers will show.
- Step 2: Go to the domain name you want to use with Cloudflare and just front of it click on the DNS option.
- Step 3: In “DNS Management”, scroll down to find the “Nameservers” card. Click “Change“.
- Step 4: Under “Choose your new nameserver type“, select the “Custom” option.
- Step 5: Enter your name servers into the “Nameserver” from fields and click on “Save” to confirm these settings.
- Once the naming server updated you can go back to the Cloudflare and click on Continue button or Recheck Nameserver. After the domain added to Cloudflare, you will see the ACTIVE status there.
How to add website domain record in Cloudflare DNS
If you already have an active website domain in Cloudflare and now incase are moving from shared hosting to VPS or dedicating hosting then you only need to replace the previous hosting IP address present in the CloudFlare records with your VPS server static IP address that’s it… However, if you are doing it from scratch then follow the below steps.
Note: If you are adding your domain first time then most of the time it automatically fetch them for you. If not then the steps are below to follow.
Step 1: Go to CloudFlare’s DNS option and click on it.
Step 2: Now set the ‘A‘ record. In the first box select the A, in the second enter your domain name (For example here we use the how2shout.com) and after that enter the IP address of your hosting server. Leave the last one Automatic TTL as it is. And click on Add record.
Step 3: Now set the CNAME record. In case you are not using the naked domain and want to use the ‘www‘ with it then this record needs to be set up. In the first box select the CNAME, in the second www and third will hold your domain name as shown in the screenshot. After that click on the Add Record.
If you want to add a subdomain to CloudFlare then again add the CNAME record but this time instead of using www add your subdomain name. For example, forum.how2shout.com is a subdomain and I want to add it in Cloud flare then instead of using www, I will use the forum which is the first initial of this subdomain and rest of will be same as it is.
That’s it, the Cloudflare has been set up successfully for your domain bound to your VPS/Dedicated/shared server. If you have any doubt, the comment box is all yours!!
You might also like to know about:
- How to setup Ubuntu server for WordPress blog/website on Droplet DigitalOcean
- Install WordPress on Cpanel – Step by Step
- How to redirect the WordPress attachment URL to parent post URL
- How to embed and view pdf in WordPress page without a plugin