one droplet multiple domains

July 10, 2015 3k views
DNS DigitalOcean

I have a couple of domains (say a.com and b.com) and would like to host them on DO with one droplet.
I initially set up a.com using my droplet (which happened to be called a.com as well).
Everything went fine and I was able to set up mail etc. Brilliant!

The problem arises now that I'd like to move b.com to DO (and initially host it on the same droplet). As with a.com I changed the names servers (on my registrar) for b.com the DO's name servers. All good so far - but when setting up the DNS entries the trouble started:

In DO's DNS web tool I created initially another A record for b.com. pointing at the same IP - but the DO DNS complains the the domain name (b.com) is not a subdomain of the initial domain (a.com) - I guess fair enough.
So I create a C record *.b.com. -> a.com. - with the same result.

And this is where I became somewhat stuck. Any ideas, hints, etc please.

Thanks in advance for your time.

  • From my understandment you are trying to create an A record of b.com into the a.com DNS. This will not work as it will give you an error. You first need to add a new domain in your DNS, of b.com , and then add the A record to the same IP

  • hi, it tried adding two sites in single droplet but nothing goes right... i am not able to make needed changes to DNS .. can you please elaborate your answer .. and what if i am migrating a website to my droplet..

    thanks in advance..

2 Answers

You'll likely be better off using Cloudflare for your DNS settings as it's a service that even DO recommend using. I have 15 websites installed on a single $5 droplet each with their own WP directory install without any issues and all, of course, pointing to the same droplet, each with their own A records, CNAME records, MX Records, SPF and DKIM yada yada yada, so it can definitely be done. If you have only just changed/added the DNS records for siteB, it might just be a case of waiting for the DNS setting to propagate.

Thanks for your replies - they were very helpful. In particular CrypticDesigns comment made me look at the DNS panel again. I got it sorted - and everything kind of makes sense once one reads the headings properly - Duh ;-).
Anyway, for anybody who will run into the same 'use case', here is what one needs to do:
When I first set up a.com I used the 'Add a Domain' section:
*a.com / the ip of your droplet (of droplet a.com) / your a.com droplet *
Now for the b.com domain do exactly the same.
*b.com / the ip of your droplet (of droplet a.com) / your a.com droplet *

This will result in now having 2 entries the Domain section

Then add A/C/MX etc records for b.com according to needs.


Have another answer? Share your knowledge.