Question

Host multiple domain in one bind server

Hello

I have an apache2 web server with two virtual hosts example1.com and example2.com, I also have a dns server and I would like my dns server to be able to resolve the domain name and display website based on the domain name.I have already installed the web server, created the virtual hosts and my dns bind9 server

Thank you.

Subscribe
Share

Submit an 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.

Ah, that would be one of the few good reasons to run your own BIND server these days. I linked to the BIND tutorial and any BIND instance will support multiple domains / zones. If you follow all of the instructions in that tutorial except for the secondary stuff, you should have a working system.

If you are actually delegating these example domains at the registrar (as reflected in WHOIS), they may require 2 IP addresses for your name servers (plural) - you can request and use what is called a “Floating IP” with your Droplet, effectively giving you a second IP address to use for your one BIND instance.

More info on those here: https://www.digitalocean.com/docs/networking/floating-ips/

Let us know how you make out with the BIND tutorial and if there are any specific parts that you need assistance with, please ask :)

Hi,

Good job making it this far. BIND is a good choice for DNS software but it is not a trivial exercise, configuring and maintaining your own DNS infrastructure.

Before I link you to the relevant tutorial, have you considered using DigitalOcean’s DNS service, located in your Cloud admin panel under “Networking > Domains”?

If not, I would recommend trying this first as it will be simpler, faster and more reliable than running your own DNS server.

Here are some relevant links to hosting your domains on DigitalOcean’s DNS:

Overview: https://www.digitalocean.com/docs/networking/dns/ Quickstart: https://www.digitalocean.com/docs/networking/dns/quickstart/

It’s a two step process, add your domain then add your records (eg, “www”):

https://www.digitalocean.com/docs/networking/dns/how-to/add-domains/ https://www.digitalocean.com/docs/networking/dns/how-to/manage-records/

If that doesn’t meet your requirements, here is a tutorial on setting up BIND for DNS - keep in mind that it expects two servers in this setup, a primary and a secondary, in case the primary goes down:

https://www.digitalocean.com/community/tutorials/how-to-configure-bind-as-an-authoritative-only-dns-server-on-ubuntu-14-04

The tutorial is a little older, so be on the lookout for differences with your current operating system. The BIND info should still be valid.

Hope this helps and good luck!