Set up a web server and email using Vultr, GoDaddy, CloudFlare and Zoho

“Wer rastet, der rostet.” – a german saying, which is the reason, why this article exists. “You snooze, you lose.” – therefore, I’m always interested in trying new technology and extend my knowledge. I could make my life a whole lot easier, by choosing one of the hosting providers out there, but that would be boring. Therefore, I’m running my own server – where I can also run custom software – with a WordPress blog using Facebook’s HHVM to speed it up, instead of using PHP or PHP-FPM – try to find a hoster, which offers HHVM.

I also wanted a reliable email address for my domain, which doesn’t end up in the receivers spam folder by default, and SSL encryption. And, as it’s just a private blog, the costs should be as low as possible.

Now, let’s start. Here’s a basic rundown of the required steps to set up your personal web server:

  • register your prefered domain with GoDaddy
  • add the domain to CloudFlare
  • change the name servers of your domain
  • deploy your Vultr server instance
  • change your DNS record to the IP of your server
  • register your domain with Zoho
  • add MX, SPF and Domain Keys records

Domain registration

Well, this is an easy task (expect finding a good domain name): Just head over to GoDaddy, type in your prefered domain name in the text field, register a new account, if you don’t have one, and pay the bill. Congratulations, you now own a domain. I am not going to show you screenshots, how to do this, as this should be really straight forward. If you fail to complete this task, you should probably not run your own server.

Add your domain to CloudFlare

What is CloudFlare and why do I need it?“, you may ask. Well, CloudFlare offers a lot of services, you can read about them at their homepage or on Wikipedia, I’m not going to repeat that, but basically, they speed up your site loading by caching (the data [images, JavaScript, CSS, etc] is minifyed and gziped and stored in a worldwide content delivery system), enhance the security and the best of all: they offer SSL encryption for your domain. All for free, if you have a small site.  All you have to do to get all those goodies is to change the name servers of your domain.

First, register a free account, then go to the websites panel, put your domain into the text field and click on “Add website”. This may take a few moments to complete, so be patient. When the process completed, click on “Continue setup”.

CloudFlare websites overview

In the next step, you will have to configure the DNS records for your domain. This list is filled with the current DNS records of the domain and contains a lot of garbage. For now, you’ll only need two records, which should already be in the list, first an “A” record with your domain name pointing to the IP of your server as value (as we didn’t set up the server yet, therefore you can leave the IP as it is, we’ll configure it later) and a “CNAME” record with the name www pointing to “an alias of your domain” (this way, http://www.bionick.net and http://bionick.net resolve to your server). Make sure both records are active. Delete all the other DNS records and continue.

CloudFlare DNS configuration

Set up the options for your domain in the next screen. For now, you can leave the options at their default values. Continue to the final screen, where you’ll see the old and new name servers for your domain. You’ll need to change the name servers at the domain registrar, so don’t close this window yet, you’ll need those information in the next step.

CloudFlare name server information
CloudFlare name server information

Change the name servers

Go to your GoDaddy account page. Select your domain and click on “Launch”.

GoDaddy Account Overview
GoDaddy Account Overview

On the domain details page, click on “Manage” beneath name server. A popup with the name server settings open. Click on “Custom”, “Add Nameserver” and enter the address of both name servers, which you received from CloudFlare. Save the changes and you’re done.

GoDaddy Domain Details
GoDaddy Domain Details

Deploy a Vultr server instance

As always, head over to Vultr, create an account, if you don’t have one, and store some money in your account (the minimum is $5, which is enough to run a small instance for one month). If you’re done, it’s time to deploy your server instance. Go to the control panel, and click on “Deploy”.

There are a lot of options, so take your time to choose. There are currently, while I’m writing this, 3 different server types available, 14 different locations, 10 different OS (Linux, FreeBSD and Windows) with the options to run a custom ISO and 5 different server sizes.

For this article, I chose the “Performance Series” server type, with Chicago as location, Debian 7 as the OS and the smallest server size for $5 a month. No additional options were checked.

After placing the order, it may take some time, before the instance is available. For this article, I ordered a new instance, and for some reason, it took about five minutes, before it was available. The instance, where my blog runs, which is not located in Chicago, was available within one minute. So, just be patient. When it is available, click on “Manage” in your server list.

Vultr server list
Vultr server list

You will get a detailed view of your server information, with the IP and the initial login. You can click through all the options and test them.

Vultr Server Information
Vultr Server Information

Now, there’s only one last step, we need to do: install an http server on your server. It’s up to you, what you chose, but for now, let’s install nginx on our Debian server. Login with the credentials to the new server via SSH (on OS X or Linux you can use the terminal, on Windows you can use PuTTY) or use the console directly by clicking on “View Console”. Install ngix with apt and you’re done:

apt-get install nginx-light

You can test, if everything worked, by pointing your browser to the IP of your server

Vultr Server with Nginx
Vultr Server with Nginx

Change your DNS records

This is the final step, before you can resolve your server via your domain name. As you can hopefully remember, while we set up CloudFlare, you had to enter an IP for the “A” record. Now it’s time to update it with the value of the IP of the Vultr server (you can view the IP on the Server Information page).

In the websites panel, click on the settings button right to your domain name (the gear wheel on the right) and chose “DNS settings”. Change the setting for the “A” record (click on the gear wheel) and update the old IP with your new IP. Save it and you’re done.

CloudFlare DNS settings
CloudFlare DNS settings

To make SSL working, you’ll have to change one more thing. CloudFlare offers different SSL options, and the default option is not compatible with our setup, as we would need to create and use a self-signed certificate on our server. I highly recommence this, but for now, we skip this part.

In the websites panel, click on the settings button right to your domain name (the gear wheel on the right) and choose “CloudFlare settings”. Scroll down to SSL and change it from “Full SSL” to “Flexible SSL”.

Et voilà, your site is available via https:

nginx with SSL
nginx with SSL

Changes take time

Changes to the name servers or to DNS records can really take some time, before they are propagated to all servers. In one case, where I moved a domain, which already in use, from one hoster to another, there were still problems after one week. From time to time, that domain was still resolved to the old IP. So be patient, if it’s not working for you directly.

Register the domain with Zoho

The server is running and you can access it with your domain, even over an encrypted SSL connection. Now let’s get to the final step and add an email address using the domain name.

You’ll have to modify the DNS settings in CloudFlare a few times, so it’s the best, if you leave them open in a separate browser tab. Here’s the overview of the DNS records, when you’re done:

CloudFlare final DNS records
CloudFlare final DNS records

Head over to Zoho Mail and add your domain. In the next step, provide your personal information and your default email address (e.g. [email protected]) and sign up. After this step, you need to verify, that you’re the owner of the domain. There are several ways to accomplish that, you can choose your prefered way. I simply created a “TXT” record in the CloudFlare DNS settings. After that, wait a minute, and click on “Verify”. You should have successfully verified the ownership of your domain. Follow the steps and add users or groups, if you want to.

The next step involves changing the “MX” records. This is, again, done in the CloudFlare DNS settings. You can find both records in the Zoho wiki. In the image above, you can see, how the MX records should look.

Click through all the other steps, until you will finally end in your inbox. Congraulations, you can send and receive emails from your domain.

Zoho Mail Inbox
Zoho Mail Inbox

The following steps are highly recommenced. Your email might work without, but to improve security and reliablility, you should also add a SPF record and DomainKeys, read more about it in the Zoho wiki. Adding the SPF record is easy, just add a “TXT” record in the DNS according to the wiki. For the DomainKeys, head over to their control panel, click on the left side on “Org Settings” and then on “DomainKeys”. Insert a something into the record name field (e.g. zoho) and click on “Generate new record”.

Again, create a “TXT” record and use the name (including the text from the input field) and value as described. After you created the “TXT” record, wait a minute and click on “Start authentication”. Now, you’re done.

Zoho Mail DomainKeys
Zoho Mail DomainKeys

 

Alternative providers

You are not restricted to the companies and their services I provided above. While I chose them, as I use them personally, you can also view this guide as a generic overview. The concept behind every step is always the same. You can still achieve the same, even if you use another domain name registrar, like gandi, namecheap, domainfactory, etc. Maybe their web site looks different, but the concept of name servers and DNS records are the same. Same with server hosting, you could use DigitalOcean, RackSpace or any other provider. If you don’t want or don’t need an email address, you can just skip this step, or if you don’t want to use CloudFlare, you can skip this step too.

 

Thank you for reading this article, I hope you enjoyed it and maybe learned something. Feel free to leave a comment, if you have any questions or suggestions.

Leave a Reply