Host multiple domain in one bind server

Posted July 5, 2019 6.7k views


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.

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.

Submit an Answer
2 answers


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:


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!

by Justin Ellingwood
Bind, the most popular DNS server, is used as the backbone of much of the world's DNS system. In this guide, we will discuss how to configure a pair of DNS servers to act as primary and secondary authoritative-only DNS servers for your domains. We will be demonstrating this on Ubuntu 14.04.
  • Hello,

    First of all, thank you for answering my question, I often lead training sessions during which I teach students system administration with linux (debian 9). So it’s as part of the practical work, I don’t intend to implement it in a production environment. I would like to do this manipulation with a single bind server (the primary one), make and coexist on the same bind server.

    Thank you

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