To get a website up at a domain name you need to follow these steps:
- Register the domain name.
- At the registrar, point the NameServer (NS) records to the domain name server (DNS) that will be handling the domain.
- On the name server, add records to resolve the host name to your server.
- Configure your web server to handle requests that come in for that domain name.
I never run my own name server. Third party name server service is dirt cheap and much more reliable. I wouldn't pay more than $10 per year for it. You really should have three or four name servers running in different locations for redundancy and reliability. It sounds like your web host has name servers for you to use and I would take advantage of that.
The DNS records on the name server can be either A records that list the IP address of your web server, or CNAME records pointing to another host name that you have already set up to point to your server. Your web host has a way for you to add these records. It is usually a web interface they give you in a control panel where you can create these records.
On Ubuntu, the recommend way to add Apache configuration for a website (substitute
example.com for your actual domain name) is:
- Create a directory for the files to be served /var/www/example.com and put the HTML files there.
Require all granted
- Enable the site:
sudo a2ensite example.com
- Restart the webserver:
sudo service apache2 restart