Adding Multiple Domain to Different Document Root Using Bind9



I'm trying to add two domains using BIND and Apache virtual host and I'm succesfully creating the master zone and after i create Virtual Host the domain is working. My problem is after i add each domain and specify the folder (document root) by creating the virtual host for that domain, all other domain roots are changing according to this domain's document root adress. For example My ip is 172..... and it is working. And im succesfully creating master zone and when browse the domain its automatically going the default var/www and after im creating virtual host for the domain and specifying the document root as home/user/public_html and after i browse the domain again i see that it works and using home/user/public_html. But IP is also going to the home/user/public_html instead of var/www while there exist default virtual server for var/www. I'm trying to solve this for days and i have a headache now. I watched many videos on youtube but nothing changed , i couldn understand at all. Can you specify where im doing wrong and guide me.


Hrm, you may need to post your Apache config in order for us to understand what's going on there.

What Linux distribution is it that you're using?


Thanks for the answer.

I'm using UBUNTU 10.04 LAMP. Can you give exact adress of the file that i can post it here. I posted a configuration file as you see my there exist my IP and the domain i added for test and if i add another domain these two IP and the first domain i added will be change according the other domain zone i will add.

Here it is if you mean this file.


Okay, so, I'm not particularly familiar with adding VirtualHosts from within Webmin (Virtualmin makes that a bunch easier) -- but, one issue I see is that it seems to be adding your entries directly to the apache2.conf file. Which is okay for CentOS, but not so much for Ubuntu :-)

In Ubuntu, you'd want it to add them to the "/etc/apache2/sites-available" directory (which should be one of the options as you create it).

Second, for the option "Handle connections to address", I think Ubuntu defaults to using "Any address" rather than a specific address.

The key though would be to make sure all your VirtualHosts match. If the others were setup with "Any address", and this new one uses a specific address, things won't work right :-) You might consider trying to switch your new one to use "Any address".


I have been tested it with swithcing to it to any. But this time it goes var/www instead of home/user/public_html. Thats the problem i couldnt figure it out. I can change it to Centos easily it not problem. But firtsly if i can solve it in ubuntu its more OK.

It looks like it may be confused by the "ServerName" of this particular domain.

The ServerName is set to ""... instead, the ServerName should just be "" -- the :80 is the port, which already appears to be set correctly.

Try setting the ServerName to just the domain name, save that, and see if that helps.


I have tested it all and again i did. Its not effecting whether i set 80 or without 80 only if select any istead of putting IP then domain goes to var/www but if i change it to IP istead of any the goes to the right place but this time if you browse IP it also goes to the place for Can we solve this problem if set the OS centos 5.


The Linux distribution you use shouldn't matter.

Though, have you considered using Virtualmin, rather than just Webmin? Virtualmin makes this a lot easier, and takes a lot of the hard work out of creating a new account and domain :-)

It of course should work with just Webmin, but since it looks like you're just getting started -- it might be a good time to ponder Virtualmin, it may make your life a bit simpler :-)


Can i install it on VPS or it has to be a Dedicated Server.


In general, it works fine on most VPS's.

The two questions I'd have regarding that are --

  1. How much RAM do you have? You can determine that with "free -m".

  2. What kind of VPS are you using? That is, what VPS software does your provider use?

I installed it on ubuntu but i want to make a fresh centos installation so now im going to install new os and virtualmin. Then i write the experience.

I have 512 MB and 2048 burstable. Solus VM.