“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
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
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”.
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.
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.
Change the name servers
Go to your GoDaddy account page. Select your domain and click on “Launch”.
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.
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.
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.
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
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.
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:
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:
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.
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.
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.