Question

Issues with subdomain not working (but works when I hardcode the ip in hosts file)

I’m trying to point a subdomain to my droplet running a nginx server. Somewhere along the way I’ve done something wrong and when I try to go to my subdomain I get “Gateway Timeout: can’t connect to remote host.”

I’m pretty sure it’s an issue with the DNS because when I add my subdomain to my hosts file and point it to my droplet’s ip address everything works great.

The following is my zone file on DO:

$ORIGIN blog.bookroo.com.
$TTL 1800
blog.bookroo.com. IN SOA ns1.digitalocean.com. hostmaster.blog.bookroo.com. 1423974942 10800 3600 604800 1800
blog.bookroo.com. 1800 IN NS ns1.digitalocean.com.
blog.bookroo.com. 1800 IN NS ns2.digitalocean.com.
blog.bookroo.com. 1800 IN NS ns3.digitalocean.com.
blog.bookroo.com. 1800 IN A 104.236.83.209

The domain is managed by NameSilo and I have the following settings:

      A	          107.161.23.204	        NA	172816	www re-direct 		
      A	          107.191.99.114	        NA	172816	www re-direct 		
      A	          142.4.203.239	        NA	172816	www re-direct 		
blog	  CNAME	  ns1.digitalocean.com	NA	172817	3rd-party		
www     CNAME	  lb.cratejoy.com	        NA	172816	3rd-party		

Can anyone see what I’m doing wrong? Thanks in advance!


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.

Ok cool. Thanks a lot for your help!

Ah ok. Things are starting to make sense. I was confusing what I’d done with NameServers with DNS records.

So… is it better to use NameSilo for DNS or do all of that from the DO side (meaning if I used the DO nameservers)?

Yes, you will need to change the IP if the IP of the droplet changes.

I don’t think you understand how DNS works.

A CNAME says to use the IP whatever hostname is referred to. If you cname blog to ns1.digitalocean.com, then the cname will return the IP of ns1.digitalocean.com, not your host.

Unless you have the DNS delegated for your domain to ns1/ns2/ns3 at digitalocean, and completely control your domain on their name servers, whatever you put into DO’s domain manager won’t have any effect.