Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am a new user of webmin and I have two domains site1.com and site2.net.

I have one dedicated IP for the server and I have set site1.com to use following name servers ns1.site1.com and ns2.site1.com with bind.

Now when I add site2.net on the same IP using the same method both sites open with the same content. How can I host both web sites on the same IP?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

The problem is that both domains are being pointed at the same hosting folder location.

If you have 2 sites labeled siteA and siteB you should have a folder structor something like this:

/home/siteA and /home/siteB or /var/www/siteA and /var/www/siteB these folders and the way domains point to them is called 'Virtual Hosts' You need to check your virtual host configuration and ensure that both directives are set and pointing in the correct location.

Depending on your Linux version the Apache configuration file may vary in location but typically its found in something like /etc/httpd/conf/httpd.conf or sites-enabled a Google search with your Linux version should give you an idea where your config file is located.

Once you located your virtual host file it should look something like:

<VirtualHost *:80>
DocumentRoot /home/siteA/htdocs
ServerName siteA.com
ServerAlias *.siteA.com
</VirtualHost>


<VirtualHost *:80>
DocumentRoot /home/siteB/htdocs
ServerName siteB.com
ServerAlias *.siteB.com
</VirtualHost>

There is many online guides on how to setup multiple vhosts using Webmin should you want some more advice other than my own a simple Google search should reveal a overwhelming amount.

share|improve this answer
    
Thank for your help, i just found apache2.conf in /etc/apache2 and here is my virtual host setting. <VirtualHost *:80> DocumentRoot "/var/www/www.site1.net" ServerName site1.net ServerAlias *.site1.net </VirtualHost> <VirtualHost *:80> DocumentRoot "/var/www/site2.com" ServerName site2.com ServerAlias *.site2.com </VirtualHost> sites are opening separately, that's worked for me. but here is still a problem even using ServerAlias site1.net doesn't open with-out www it works with www.site1.net how to handle this prob. error is " don't have permission to access / on this server. Thanks –  user838037 Mar 2 '13 at 21:28
    
Make sure your name servers are setup correctly with the www @ ip –  bybe Mar 2 '13 at 21:39

[not a answer, just to sort order my code] @bybe, still getting problem http://site1.net doesn't' work. server ip : 192.168.1.100 domain registrar with rdns: mainsite.com here is my Edit Records File /var/lib/bind/

$ttl 38400
site.net.   IN  SOA 192-168-1-100.local. admin.site1.net. (
            1317411372
            10800
            3600
            604800
            38400 )
site1.net.  IN  A   192.168.1.100
ns1.mainsite.com.   IN  A   192.168.1.100
ns2.mainsite.com.   IN  A   192.168.1.100
site1.net.  IN  NS  ns1.mainsite.com.
site1.net.  IN  NS  ns2.mainsite.com.
www.site1.net.  IN  CNAME   mainsite.com.
*.site1.net.    IN  A   192.168.1.100
mail.site1.net. IN  A   192.168.1.100
site1.net.  IN  MX  1 site1.net.
site1.net.  IN  NS  192-168-1-100.local.

and here my virtualhost setting

<VirtualHost *:80>
DocumentRoot /var/www/www.site1.net
ServerName www.site1.net:80
<Directory "/var/www/www.site1.net">
allow from all
Options +Indexes
</Directory>
ServerAlias *.site.net
</VirtualHost>

other site on this server working perfectly with this same configuration. but don't know here what i am doing wrong. let me know where is problem. thank you

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.