Host multiple domain in one bind server


I have an apache2 web server with two virtual hosts and, 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.

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.

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:

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 :)


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: Quickstart:

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

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:

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!