How to Add Two Domains ON 1 IP using webmin

8,623

Solution 1

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.

Solution 2

  1. Open your webmin
  2. Go to servers
  3. Go to Apache Webserver
  4. Create virtual host
  5. Check if it works from Existing virtual hosts and it well look like below: enter image description here

Solution 3

www.site1.net.  IN  CNAME   mainsite.com.

You have setup site1.net as an alias of mainsite.com The DNS now overrides the virtual host and alters your records and redirect you to mainsite.com


Just leaving this here as a reference.

Share:
8,623

Related videos on Youtube

user838037
Author by

user838037

Updated on September 18, 2022

Comments

  • user838037
    user838037 over 1 year

    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?

  • user838037
    user838037 about 11 years
    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
  • Simon Hayter
    Simon Hayter about 11 years
    Make sure your name servers are setup correctly with the www @ ip