There are 2 approaches to point your domain to your VPS server:
- Configuring your own DNS software, to use for hosting the domain DNS on your own VPS.
- Using an external DNS service to host the domain DNS with another DNS service provider.
Of course, the second approach is the best one to consider, not only to save time from going through the complex configuration steps of installing and running a DNS software but also because it is much more reliable.
Without a doubt, the best free DNS service provider out there is Cloudflare for numerous reasons, aside from their reliable and fast DNS services, you can also benefit from the performance and security features that come free with it.
There's a tutorial on YouTube explaining the whole process of pointing a domain to a VPS:
Or you can carry on with the article here. First, begin by creating an account at Cloudflare and add your domain there. Visit this guide on Cloudflare website for detailed steps:
Once you complete the signup process and add your domain, you will be provided with a set of nameservers that should be used, in order to host the domain DNS on Cloudflare.
You should go to your domain name control panel to update the name servers. This will depend on your domain name provider. For example, if you registered your domain with us, visit this guide to learn how to update name servers for a domain:
If your domain is registered with another provider, please reach out to your provider support for help updating name servers for the domain.
Once the domain is updated to use Cloudflare name servers, the next step is to add proper DNS records in order to point it to your VPS. Visit this guide on Cloudflare to learn more about how to add/edit DNS records:
Generally, you would start with 2 records:
Atype of record, which is used to send web traffic to the destination server. The value of the
Arecord is always an IP address (your VPS IP in this case).
CNAMEtype of record for the "www" part of the domain, or you can use "@" to universally point all subdomains to the IP of the primary root domain. The value of the
CNAMErecord will be your root domain.
Of course, pointing the domain is just part one of the process of linking a domain to your VPS. The next steps are to configure the web server software in the VPS, and to configure the virtual hosts for that domain. This will vary depending on the OS, and type of web server software (apache, nginx, etc) you are using. However, searching Google and dev sites like StackOverflow with keywords specific to your own use case will yield a lot of useful results.
Below is a guide (Steps 1 to 5) that explains how to configure the domain when using Apache as the web server: