Click to See Complete Forum and Search --> : Virtual Host Directories


baragon0
08-28-2002, 10:01 AM
I'm trying to set up a virtual host, here's the scenario.

The default path for the webspace is /var/www/html

I made a virtual server (by domain name) with the path pointing to /var/www/site

Now, on the GUI configuration, there is no trace of /var/www/html, but on the text configuration, there are a few instances, such as DocumentRoot under Virtual Host, but under the Virtual Host entry for my site, it does show up /var/www/site

The problem is, when I access the site, it goes to /var/www/html

I want to be able to host multiple sites off of this computer, using one IP address and many domains and DNS.

goon12
08-28-2002, 10:34 AM
This might help:
http://www.redhat.com/support/resources/faqs/RH-apache-FAQ/x125.html

nomo_green
08-28-2002, 03:21 PM
this should help explain configuration and has some examples also:

http://httpd.apache.org/docs/vhosts/

:D

baragon0
08-28-2002, 05:57 PM
Looked through it all, and I got it to work, but it only works when I enter http://www.domain.tld and not when I enter http://domain.tld

When I enter http://domain.tld, it goes to the main account (where the rest of undirected traffic goes)

I can't find an answer in the documentation. Anybody? Is this problem DNS related?

baragon0
08-28-2002, 06:17 PM
Well, fixed it by making a virtual host for each

kZahradnik
08-29-2002, 11:09 AM
I don't know if it helps any, but here is my VirtualHost setup (like 20 Domains running on there):
<VirtualHost 213.229.59.9>
ServerAdmin klaus@kwz.at
DocumentRoot /www/kwz/phpMyAdmin/
ServerName mysql.kwz.at
CheckSpelling Off
</VirtualHost>


<VirtualHost 213.229.59.9>
AddHandler cgi-script cgi pl
Options Indexes FollowSymLinks MultiViews
ServerAdmin klaus@kwz.at
DocumentRoot /www/kwz/home/
ServerName www.kwz.at
ServerAlias kwz.at *.kwz.at
CheckSpelling On

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
CustomLog "|/usr/local/sbin/cronolog /www/kwz/log/combined_%Y-%m-%d.log" combined
ErrorLog "|/usr/local/sbin/cronolog /www/kwz/log/error_%Y-%m-%d.log"

<Directory "/www/kwz/home/cgi-bin/*">
Options +ExecCGI
</Directory>
</VirtualHost>

baragon0
08-29-2002, 06:36 PM
What exactly is a "ServerAlias"? Couldn't find it in the documentation.

kZahradnik
08-30-2002, 03:17 AM
A ServerAlias defines the other names This VHost container respondes to.


<VirtualHost 213.229.59.9>
ServerName www.domain1.tld
ServerAlias *.domain1.tld domain1.tld
ServerAlias *.domain2.tld domain2.tld
.
.
.
</VirtualHost>

Will define a Virtual Host named www.domain1.tld. Without the ServerAlias it only would respond to www.domain1.tld.
But the *.domain1.tld tells it to respond to ww2.domain1.tld or wwwww.domain1.tld ,...
the domain1.tld tells it to respond to the domain alone as well.
Play with it! ;)

Best regards
Klaus