Koozali.org: home of the SME Server

Setting Up Vitual Domain

Offline nefkho

  • *****
  • 183
  • +0/-0
    • http://www.cagothonglines.com
Setting Up Vitual Domain
« on: October 08, 2007, 09:29:53 AM »
Hi,

i have my primary domain setup and its working fine, but i need to add additional domain and was able to setup, but how can my 2nd domain be seen on the internet?

thanks,

Nef Kho  :-) .........

Offline mmccarn

  • *
  • 2,653
  • +10/-0
Re: Setting Up Vitual Domain
« Reply #1 on: October 08, 2007, 10:03:55 AM »
Virtual domains must be accessed using the specified virtual domain name, since that is how SME picks which website to return.

To access a virtual domain from the Internet you must configure the new domain on a public DNS server, and configure that server to point to your SME's IP address. (see http://wiki.contribs.org/SME_Server:Documentation:Administration_Manual:Appendix#Appendix_B._DNS for some general DNS info)

For testing, you can create a 'hosts' entry for the virtual domain on a workstation. 

In windows the 'hosts' file is located at c:\windows\system32\drivers\etc\hosts.  You can add an entry to this file using:
Code: [Select]
echo a.b.c.d mydomain.com >> c:\windows\system32\drivers\etc\hosts or:
Code: [Select]
notepad c:\windows\system32\drivers\etc\hostsBe careful in the first case to use the double >> so you don't overwrite your existing hosts file.  Be careful in the second case that notepad doesn't automatically add ".txt" to the file when you're done - 'hosts' needs to be just that - 'hosts' (not 'hosts.txt').

If you get a 'hosts' entry created successfully you should be able to ping my.virtualdomain.com and have it display the correct IP address in the output (whether or not the ping succeeds).  Note that nslookup my.virtualdomain.com will fail until you get the public DNS server setup as nslookup does not examine the hosts file.

Offline nefkho

  • *****
  • 183
  • +0/-0
    • http://www.cagothonglines.com
Re: Setting Up Vitual Domain
« Reply #2 on: October 08, 2007, 10:09:11 AM »
thanks,

in my public DNS server setup, will i point to my sme external ip? would it conflict with my primary website as it is pointing to my sme external ip?
Nef Kho  :-) .........

Offline mmccarn

  • *
  • 2,653
  • +10/-0
Re: Setting Up Vitual Domain
« Reply #3 on: October 08, 2007, 10:22:01 AM »
Yes, point to the SME public IP.

No, it won't cause any problems.

Use 'A' records for both domains (not CNAME records), something like this:

www.primarydomain.tld  in   A   w.x.y.z
www.virtualdomain.tld   in    A   w.x.y.z

When your users try to access 'www.virtualdomain.tld' the URL request itself includes the 'virtual' domain name, which SME then uses to direct the user to the desired domain -- all on one IP.