[clue-tech] Apache 2 default host and virtual hosts

Angelo Bertolli angelo at freeshell.org
Wed Jul 27 12:44:47 MDT 2005


I am running apache2 at home.  I have tried to do the following:

1) Set a default DocumentRoot so that any domain name which isn't 
specified as a VirtualHost will display the default apache page.

2) Add a couple virtual hosts.

The virtual hosts work, but the default doesn't work.  Instead it seems 
to be using the first virtual host as the default.  I know I could work 
around this by adding another virtual host to point to the default 
location, and making it the first one, however I would prefer if I could 
get it to work without using a virtual host as a default.

Here is the relevant config that I have (in order):

[snip]

DocumentRoot "/var/www/html"
ServerAdmin admin at localhost

<Directory />
   Options FollowSymLinks
   AllowOverride None
</Directory>

<Directory /var/www>
   Options Indexes FollowSymLinks MultiViews
   AllowOverride None
   Order allow,deny
   allow from all
</Directory>

<Directory /var/www/html>
   Options Indexes FollowSymLinks MultiViews
   AllowOverride None
   Order allow,deny
   allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
   AllowOverride None
   Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
   Order allow,deny
   Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel info
CustomLog /var/log/apache2/access.log combined

ServerSignature On

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
   Options Indexes MultiViews FollowSymLinks
   AllowOverride None
   Order deny,allow
   Deny from all
   Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

UserDir disabled

NameVirtualHost *

<VirtualHost *>
DocumentRoot /var/www/descartes/html
ServerName descartes.homelinux.org
ServerAdmin admin at descartes.homelinux.org
ServerAlias www.descartes.homelinux.org
ServerAlias descartes.homeunix.net
ScriptAlias /cgi-bin/ /var/www/descartes/cgi-bin/
CustomLog /var/www/descartes/log/access.log combined env=!exclude
<Directory /var/www/descartes/html>
Options ExecCGI FollowSymLinks Includes Indexes
AllowOverride All
</Directory>
UserDir html
UserDir disable root
</VirtualHost>

[snip]

This seemed to work on Apache 1.  Should there be any difference?

Angelo

_______________________________________________
CLUE-tech mailing list
CLUE-tech at cluedenver.org
http://cluedenver.org/mailman/listinfo/clue-tech



More information about the clue-tech mailing list