DNS config for subdomains of externally hosted website

January 27, 2015 1.6k views

Hi,

my website is not hosted on Digital Ocean. I want to host a subdomain of this website on Digital Ocean.

I did the following:
1) all 3 Digital Ocean NS are registered with my domain
2) Set the domain in Digital Ocean Control Panel
3) in Domain view:
A @ IPADDRESS of hosting server
A MY
SUBDOMAIN IPADDRESS of droplet
CNAME WWW WEBSITE
URL
CNAME *.MYSUBDOMAIN MYSUBDOMAIN.WEBSITE_URL
3 Nameservers (Defaults)

What is the problem?

Ivan

3 Answers

If you changed your NS records like that all your domain is being send to DO NS servers, so maybe you current website is offline by now.

If you need to use a subdomain to direct your traffic to DO Droplet just add an A record to the DO Droplet Public IP.

A Name DROPLET PUBLIC IP

Example:
A www2 3.3.3.3

You do this from your current register DNS Panel.

  • Hi,

    thanks for your answer but,
    i have one entry
    A @ IP address of host server

    and the website is online.

    I want that all *.website.com except www go to my droplet.

    How can i manage that?

  • it depends of your DNS manager, but look for the wildcard used by it, I don't use DO dns manager, I use Cloudflare (which you should check) and the wildward is *, so you may need something similar to this

    Record name ip
    A @ dropled IP (where "@" means itself).
    A * dropled IP
    A www whatever IP you want it redirect to

    Now that is completely opposite to what you stated on your initial question, so I hope is what you are looking for. Also you may can post a screenshot of your DNS records to help us understand what you are doing.

  • Hi,

    here is my zone file. So i am trying to direct all subdomains of my web site to droplet and the www.mywebsite.com and mywebsite.com should be directed to the server where my website is hosted (not digital ocean).

    $ORIGIN mywebsite.com.
    $TTL 1800
    mywebsite.com. IN SOA ns1.digitalocean.com. hostmaster.mywebsite.com. 1422463802 10800 3600 604800 1800
    mywebsite.com. 1800 IN NS ns1.digitalocean.com.
    mywebsite.com. 1800 IN NS ns2.digitalocean.com.
    mywebsite.com. 1800 IN NS ns3.digitalocean.com.
    mywebsite.com. 1800 IN A HOSTIPADDRESS
    www.mywebsite.com. 1800 IN A HOSTIPADDRESS
    *.mywebsite.com. 1800 IN A DROPLETIPADDRESS

  • I'm assuming this is from your current domain register DNS service?

    mywebsite.com. 1800 IN NS ns1.digitalocean.com.
    mywebsite.com. 1800 IN NS ns2.digitalocean.com.
    mywebsite.com. 1800 IN NS ns3.digitalocean.com.
    You don't really need to set NS servers if you are not planning to use DO dns manager, if you do, then so far so good.

    mywebsite.com. 1800 IN A HOSTIPADDRESS
    www.mywebsite.com. 1800 IN A HOSTIPADDRESS
    *.mywebsite.com. 1800 IN A DROPLETIPADDRESS

    This is correct too, assuming * is the wildcard used by your DNS server.

    Now just make sure your droplet webserver (Apache/Nginx/Whatever) is configured to respond to any domain it receives.

Have another answer? Share your knowledge.