Sub-domain from a different host pointed to droplet

July 14, 2015 3.5k views
DNS Nginx

Hi there,
I have found several related questions, but none of them help me much to solve my problem with pointing a sub-domain to Digital Ocean.

Situation:

  • I have a domain name hosted with a hosting company: example.com;
  • I want to have a sub-domain (test.example.com) pointed to my droplet in ways when a user access test.example.com, the browser shows my droplet content, instead of the hosting service content, without showing my IP address on the browser address bar.

My questions:

  • I read that I have to change A records for the test.example.com subdomain to point to droplet IP. Is this done on the Hosting Company Control Panel?
  • Since it is only a sub-domain (not a domain name), do I require to setup anything on DNS settings for my account on Digital Ocean?
  • My web service is already working on Digital Ocean droplet on a specific port. When I access my droplet IP address:port, I can see the content I want. Since I am using nginx, do I have to do anything on xginx configuration in order to make this test.example.com to point to this ip address:port?

The idea is to allow user to browse the droplet content, without seeing the IP address of the droplet. They should only see test.example.com.

Hope anyone can help me

Thank you in advance

Regards

Paulo

2 comments
  • Just a small comment
    "The idea is to allow user to browse the droplet content, without seeing the IP address of the droplet. They should only see test.example.com"
    Domains are only there to give the users of a specific service the ease of using a domain to "connect" to it instead of the IP. I don't know if you meant this, but you can not hide your IP or something. With a small ping, its found ;)

  • Thank you CryptDesigns,
    Yes, I do know that but, If I made myself missunderstood, what I meant to say is, that I want to allow users to browse the droplet content (web page or app inside of it), without having to remember the droplet IP adress. The idea is to hide the IP adress whille user is surfing the web site. As an exact example, when you're surfing digital ocean web site, you always see the dns on the browser address bar and not the IP.

    Thank you once again for your time

    Regards

    Paulo

1 Answer

You will need to log into your other hosting company's control panel and access your DNS settings for this domain. There you will add an A record pointing the subdomain to your droplet's IP address. You do not need to do anything in the DigitalOcean DNS section since your domain itself is not delegated to our DNS servers.

If your web service is running on a port other than 80(http) or 443(https) you will want to adjust nginx to listen on port 80 (or 443 if you have an SSL certificate installed). A DNS record cannot generally be used to specify a port, only an IP address.

Have another answer? Share your knowledge.