Report this

What is the reason for this report?

Sub-domain from a different host pointed to droplet

Posted on July 14, 2015

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



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
  1. Add an A record in your domains host, pointing to droplet’s ip.
  2. Look https://www.digitalocean.com/community/tutorials/how-to-deploy-a-laravel-application-with-nginx-on-ubuntu-16-04 this tutorial. If ur sub domain is sub.domain.com, then you will also need a /etc/nginx/sites-available/sub.domain.com beside the IP.

This is how it worked for me.

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.