Ok, so here's my problem: I've set up myself a virtualhost with an appropriate server name. I also have, for example, Squirrelmail and SVN installed on the same machine. I want to get to the default page by typing http :// mydomain , get to my mail frontend by typing http ://mydomain /mail and to my svn by typing http :// mydomain.no-ip.org /svn.
Heres my vhost definition:
<VirtualHost *:80>
ServerName mydomain.no-ip.org
#Default site, accessible by http :// mydomain.no-ip.org/
<Location />
DocumentRoot "/var/www/alias"
DirectoryIndex index.php
</Location>
#Squirrelmail, accessible by http :// mydomain.no-ip.org /mail
<Location /mail>
DocumentRoot /usr/share/squrrelmail
Options FollowSymLinks
<IfModule mod_php5.c>
php_flag register_globals off
</IfModule>
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>
<Files configtest.php>
order deny,allow
deny from all
allow from 127.0.0.1
</Files>
</Location>
#SVN, accessible by http :// mydomain.no-ip.org /svn
<Location /svn>
DAV svn
SVNParentPath "/svnrepo"
SVNListParentPath On
AuthType Basic
AuthName "My SVN Repo"
AuthUserFile "/svnrepo/htpasswd"
Require valid-user
</Location>
However, there's a problem with that one; when trying to restart apache, it says that you can't define a DocumentRoot
within a Location
. Therefore, there's something that I'm doing wrong, but I don't yet know what exactly.
When browsing serverfault to find if anybody had a similar problem, I've found a link to Apache's vhost examples: http://httpd.apache.org/docs/2.0/vhosts/examples.html , hovever, I can't figure out which example would be the best one there.
To be honest, neither am I versed in apache and it's ways, so I know what I've just written may be, to you, nonsensical at best.
So, anybody knows how to solve my problem, please? Any help would be greatly appreciated!
Best Answer
Indeed, you cannot have another
DocumentRoot
; you'll want anAlias
instead.Drop the
DocumentRoot
from the<Location>
block, and replace it with this (which must be outside the<Location>
block):And let's apply those SquirrelMail settings to the directory instead of the location; just swap out the definitions at the top and bottom of the block:
Also, it's unlikely that there's any permissions settings anywhere that apply to the SquirrelMail directory. You'll probably need this or similar in the
<Directory /usr/share/squrrelmail>
section: