Entry
I have installed Apache on W2000 and it works. But I can't set up Virtual Hosts. Help?
Nov 16th, 2001 00:45
Anthony Boyd, Nicole Nielsen,
Usually, to set it up, I manually create the directory for this new
site, and then add a <VirtualHost> tag to httpd.conf, like this:
<VirtualHost www.othersite.com>
ServerAdmin webmaster@othersite.com
DocumentRoot /usr/local/apache/othersite
ServerName www.othersite.com
ErrorLog logs/othersite-error_log
TransferLog logs/othersite-access_log
</VirtualHost>
Then I save the file and restart the server. Unfortunately, you need
to tell your DNS server (or your ISP) to point requests for
www.othersite.com to your server's IP address. So just adding a
VirtualHost to httpd.conf isn't enough. And of course you need to have
registered the domain name (duh).
There is another way to do it that avoids the DNS server problem. That
is to use ports. Try this:
<VirtualHost 127.0.0.1:8080>
ServerAdmin webmaster@othersite.com
DocumentRoot /usr/local/apache/othersite
ServerName www.othersite.com
ErrorLog logs/othersite-error_log
TransferLog logs/othersite-access_log
</VirtualHost>
But you also need to add a Listen line to the httpd.conf file (Listen
lines usually appear near the end of the file), like this:
Listen 8080
And then save the file and restart the server. In your browser,
type "http://localhost:8080/" to get at the "other" site.
If you have trouble, first thing to check is the DocumentRoot line, on
Windows 2000, it might look like this instead:
DocumentRoot C:\Program Files\Apache\othersite