Configuring OVH VPS with Namecheap domain name

So, we bought a VPS from OVH recently to cover some things that we could not do with the shared hosting we have from Namecheap. After the payment was processed and the VPS configured, we were provided with an IP address that we can use to access the VPS.

We wanted to be able to access the VPS using a domain name rather than an IP, it’s simple and also easy to remember. However, since we are using the main domain name (wickerlabs.com) with our shared hosting, we had to create a subdomain and point it to our vps.

It sounds easy, which it is, but if it is your first time doing it, things can be confusing. Because of the way namecheap operates, if you are using their hosting  package you have to use the Web Hosting DNS which is configured through cPanel. After some time tinkering with DNS records to no success, the best and simpler way that I found was as follows.

1. Create an alias

The reason for this is that you don’t have to create an actual subdomain, and it is easier to manage. To do this, login into your cPanel >> Domains >> Aliases.  Fill in the domain name you would like to use like so:

Creating an aliasAfter the alias is created, by default it should point to the same IP address as the main domain. Here is the nslookup result:

NSLookup 1

2. Point domain to VPS IP address

So after you have created the alias and confirm that it works like what we did with nslookup. The next stage is to configure the domain name to point to the IP address of the VPS. To do this, head over to your OVH control panel and select the VPS you want to use. You will be provided with the details of the VPS including the IP address.

OVH Control panelOnce you have copied the IP address of the VPS, go back to the cPanel and navigate to: Domains >> Zone editor. You will see a list of your aliases or domains.

List of aliasesFind the domain you created earlier and click on ‘Manage’. Now, find the domain name in this case ‘vpstut.wickerlabs.com‘ and click ‘Edit’ on the record with type A. Change the default IP address to the one of your VPS and save the changes.

Configuring the Alias IP addressAfter saving the changes, you will end up with a configuration that looks like so. Notice the difference in the IP addresses below.

After changing DNS records to VPS

3. Patience

It usually takes a short amount of time for the changes to reflect. What I’ve found to work well, is wait for around 5-15 minutes and check to see if the changes done are in effect. While writing this article, my case took around 9 mins.

If we now run nslookup on the domain, we get the following results:

Confirming DNS changesAt this point, I can access my VPS using the domain name ‘vpstut.wickerlabs.com‘ rather than ‘145.239.xxx.xxx

Hope you’ve enjoyed this article and that it helps you out with your configurations.

Regards,
Yusuph Wickama