4

I own a domain through Namecheap and a VPS with Linode. I would like to point my domain at the vps ipaddress. So far I have added the following:

TYPE                     HOST    VALUE           TTL
A + Dynamic DNS Record    www    vps ipaddress   Automatic

Im a little confused as to whether the above is correct or should I have just selected A Record instead of A + Dynamic DNS Record (not sure of the difference).

Also, do I need to change the following so that VALUE equals my domain:

TYPE            HOST    VALUE                        TTL
CNAME Record    www     parkingpage.namecheap.com    30min

or do I need to add an additional CNAME Record with my domain and leave the existing one as is. I've read through this but am not entirely sure if I need to do anything: link

Lastly, there is already a line item for:

TYPE                  HOST    VALUE                             TTL
Url Redirect Record   @       http://www.example.com  unmasked

Does the above mean that people typing in www.example.com or just http://example.com will both get directed to the www version?

UPDATE:

I've managed to make some progress. My complete list of A Records are now as follows:

TYPE         HOST    VALUE            TTL
A Record     @       vps ipaddress    Automatic
A Record     www     vps ipaddress    Automatic

If I ping www.example.com I can see that it is pinging my ip adress on linode servers. However if I try ping example.com then it just hangs. So the www part is working. How do I get the the non www version to also work?

4
  • it's not clear what you'd like your default domain to be - are you looking to host on www.example.com, example.com or optionally both? The last line will redirect example.com -> www.example.com Dynamic DNS is for if your server IP might change. For example, if you're running a home server on dial-up from a poo of IP addresses. You just want a standard A record for your setup.
    – L Martin
    Feb 8, 2017 at 9:24
  • Ok thanks. Yes I just want a standard A record so I have changed it accordingly. I want to use www.example.com. So if someone goes to example.com it should redirect them to www.example.com. So from your comment, the redirect should be working correctly already. I just need to wait for the A Record to take effect, which I believe could take 24 hours?
    – darkpool
    Feb 8, 2017 at 10:55
  • Do I need to do anything with the CNAME Record? Do I need to add one for my own domain in addition to the one that already exists for parkingpage.namecheap.com?
    – darkpool
    Feb 8, 2017 at 10:58
  • The Cname makes sure that when a domain is looked up - it redirects to the 'real' domain's IP address. In this case, parkingpage.namecheap.com is redirecting to www.example.com. Your virtual host will have to be setup to receive requests on that domain or to rewrite.
    – L Martin
    Feb 8, 2017 at 13:33

2 Answers 2

3

Here's the setup you want:

  1. An 'A Record' pointing to your VPS server IP. In this case, example.com. Or: "A Record | @ | VPS IP address"
  2. A Cname record stating the subdomain (www) is the same as the root version (@). Or: "Cname Record | @ | www.example.com". This means when someone looks up 'www.example.com' it redirects them to the A record for 'example.com'
  3. Remove other A or Cname Records with @ or www in them as a 'Host'. These are conflicting with the first two directives.

Now make sure your host is configured to respond to both www.example.com and example.com in it's config. Redirect the example.com requests to www.example.com using a 301 redirect in Apache/Nginx/IIS. An example Apache setup using the rewrite module would be:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

It's generally a bad idea to cname your root (@) domain if you're using subdomains. This could save you a headache in the future. You can also set up two A records (one for www, one for @) but then when you change the IP it means changing both. A Cname makes it look up another record - so you only need to change one. This is just good practice but your method of setting two A records works fine.

1

As per my experience, here are the basic steps -

  1. Add Linode nameservers as custom nameserver with the domain. You may find this option from your NameCheap account.

  2. After couple of hours, check if your domain is mapped with Linode nameservers. Run this command

    host -t ns yourdomain.com
    
  3. Once nameservers are updated, create a Domain Zone with your domain with Linode IP in Linode DNS Manager with default option. This will create necessary record for the domain, i.e. http://yourdomain will point to linode ip.

  4. For www.yourdomain, create a A record, put 'www' in hostname, and IP. This will point www.yourdomain to your Linode ip.

Reference :DNS Manager Guide - Linode

1
  • Thanks for the answer but this involves using Linodes name servers which I dont want to do. I want to continue using namecheaps nameservers and simply redirect the domain to my vps ip address.
    – darkpool
    Feb 8, 2017 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.