Question

droplet for subdomain of domain hosted elsewhere

Hi,

I already read https://www.digitalocean.com/community/questions/set-my-droplet-to-be-a-subdomain-of-a-domain-hosted-on-a-different-server but I have more questions.

I have a droplet that I want it to respond to requests made to a subdomain sucha as subdomain.domian.com

domain.com is hosted elsewhere, so name servers are not DO’s, but are the name servers of the hosting provider.

I named the droplet with FQDN, so PTR record exists.

I created the A record at the hosting DNS manager, pointing to droplet IP. That was 21 hours ago. I guess that is enough time for propagation, specially if no name servers were changed.

“# host subdomain.domain.com ns1.digitalocean.com” returns 5 (refused)

I don’t know if a have to add a domain to the droplet even if the name servers are not DO’s. No tutorials or community questions answer this.

So I added the domain to the droplet, and changed the NS records to point to the hosting name servers. Don’t know if this requires propagation time as well. I did this 2 hours ago.

“# host subdomain.domain.com ns1.digitalocean.com” now returns 3 (NXDOMAIN). Same result if using the hosting name servers.

The droplet already has an nginx server running.

I already powered off and on the droplet.

Don’t know what is missing or incorrect.

Please help.

Best Regards.


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

@oguerra

When adding an A entry, it should look something like:

A        sub        DROPLET_IP

Once the sub-domain A entry exists, you’d need to setup a proper server block for the sub-domain by either modifying the default server block or creating a new one, then restart NGINX for the changes to take.

The default server block for NGINX can be found here:

/etc/nginx/sites-available/default

Within the above file, you’ll see server_name, which what you’d modify.

server_name sub.domain.com www.sub.domain.com;

You’ll also want to modify root to tell NGINX where to find the files you’re uploading and want to use for the sub-domain.

Beyond that, what else needs to be modified depends on what you’re trying to setup (PHP, NodeJS, Python, etc).