Choosing and setting up your Domain name

Your website is now fully working but it does not have a proper domain name. We need to create a domain name and map it to our website. When you consider the phpMyAdmin website (our SQL client) your server is already supporting one website. This will be the second. Thankfully Apache allows for multiple websites on the same server using the Vhosts. The concept of Virtual Hosts allows Apache to receive requests for multiple different domain names all pointing at the same server with the same IP Address. Apache will receive the request for a webpage from a particular domain and direct it appropriately to the correct folder relative to the document root (/var/www/html).

Before we set up a Vhost we need to purchase a domain name. There are many different companies and organisations offering Domain Names. The prices vary based on the popularity of the name and its likely popularity as a Search Term on Search Engines. Years ago there were very few Top Level Domains. The most popular and important TLD is obviously .com. but there is an ever-growing range of options in terms of TLD and they also vary in price. For the purposes of this blog, I will choose the cheapest domain I can find and purchase it for as short a period as possible.

Readers should give some consideration to how serious they are about their website before they purchase the domain name. If you only purchase it for one year, it can be very frustrating when the renewal notice comes in and it costs way more for the second and subsequent years than it did for the first year.

Directing your Domain to your website involves using the correct Domain Name Server. Domain Name Servers maintain a phonebook-like list of domain names and their IP Addresses. For a detailed explanation of the Domain Resolution Process see this post Explanation of DNS resolution process. To make this work and have the Top Level Domain direct the domain name to correct Name Server we need to supply our Domain Registry (possibly, or with the Name Server of our host service - in my case Vultr, but this could well be Digital Ocean, Azure, AWS or some other such hosting company. Each of these companies has Name Servers (generally two, one and a backup). Your account on this service will allow you to register your Domain Name on this server and map it to the IP Address of your server. Once the Top Level Domain is directed to your hosting company's Name Server, it may take some time for the DNS entry on your hosting DNS to propagate through to the Top Level Domain and root servers. This can be anywhere from 10 minutes to a day or so.

Once you have purchased your domain name you can go ahead and set up your Apache Virtual Host. To do this complete the following form and click the button. This will generate the appropriate conf file.


Once this has been generated copy the file. Login to your server (as root) via putty and create a new file in the Apache2 sites available folder as follows - (replace tennisclub with the name of your app)

sudo nano /etc/apache2/sites-available/tennisclub.conf

Copy the markup code generated above into your file and save it using CTRL-X. Next, just as we did with the phpmyadmin.conf file, we need to enable the website using a2ensite as follows

a2ensite tennisclub

You will be prompted to have Apache reload its configuration using the following command go ahead and do this.

systemctl apache2 reload

Now we need to register our domain name in our local hosting company name server. In my case this is Vultr. Login to Vultr and