Setting up 2 or more domains on Apache with one IP address elegantly -- is it possible?

Setting up 2 or more domains on Apache with one IP address elegantly -- is it possible?

Post by George Kirik » Sat, 09 May 1998 04:00:00



Hello,

I'm in the process of setting up some domains using the Virtual IP
capability of one of the hosting services, and came across a problem
which yet to be resolved. Hopefully someone can offer some suggestions
on the proper Apache configuration.

The first domain is abc.com, and has a real IP address (eg.
123.123.123.123). This is my main account, which has POP mail, SMTP
mail, FTP, Telnet, etc.

The web directory is /abchome/www

If I place index.html in /abchome/www, all is well for the www.abc.com
domain. In order to save money (i.e. to share the account, and it's
total transfer limits, etc.), I'd like to place a second domain into
the same account, say xyz.com.

It was suggested that I create a subdirectory under www, to
/abchome/www/xyz, and then I'd put a new index.html there for the
xyz.com domain.

However, the hosting company created an index.cgi script in PERL which
redirects the requests for www.xyz.com into the xyz directory, and som
when users of Netscape 4.0 etc request www.xyz.com, Netscape shows the
resulting URL to be: http://www.xyz.com/xyz/ . Furthermore, www.abc.com
shows up as http://www.abc.com/index.html.

This seems to be a bit inelegant (i.e. there is an EXTRA xyz/ for the
www.xyz.com domain in the URL, and the extra index.html in the URL for
www.abc.com domain.

So, my question is there a way to achieve the "optimal" result, namely:

www.abc.com    shows up in the browser as http://www.abc.com/

AND

www.xyz.com    shows up in the browser as http://www.xyz.com/

(etc. for any additional domains)

I would have thought it would be just a matter of changing the default
directory that each domain looks at (which sounds fairly simple).
Ideally I'd like the directories to be setup under the one main
account as:

/abchome  <--- my root for the main account abc.com with the real IP number
/abchome/www <-- place home page, index.html here, for www.abc.com
/abchome/www/xyz <-- place home page, index.html here for www.xyz.com (virtual)
/abchome/www/def <-- place home page, index.html here for www.def.com (virtual)

Any suggestions?

With many thanks in advance if this can be done (and equal thanks if
one can verify that it *can't* be done without putting extra junk at
the end of the URL in the browser).

Regards,

--
+--------------------------------------------------------------------+

| Toronto, Canada          Telephone: (416) 588-0269                 |
+--------------------------------------------------------------------+