httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@kanka.de
Subject [users@httpd] Alias-ed directory appears on multiple virtual hosts
Date Tue, 07 Dec 2010 18:08:51 GMT
Hello,

I've switched to a new debian server with apache 2.2.9 and installed the 
'phpgadmin'
tool via a debian package.
This copies the php sources outside of /var/www and sets an 'alias ..'
directive in /etc/apache2/conf.d/

Now what happens to my surprise is that /phppgadmin is accessible via
all my virtual hosts, not just the one (base host) where it is
defined.

I also decided to serve the tool only via https, so I moved the
directive to the SSL part of my config.
Simplified, my vhost.conf (included by httpd.conf) looks like this:

NameVirtualHost 1.2.3.4:80

<VirtualHost  1.2.3.4:80>
         ServerName www.onesite.com
         ServerAlias onesite.com *.onesite.com
         DocumentRoot /var/www/
</VirtualHost>
<VirtualHost  1.2.3.4:80>
         ServerName www.twosite.com
         ServerAlias twosite.com *.twosite.com
         DocumentRoot /var/www/two/
</VirtualHost>

## SSL ##
NameVirtualHost 1.2.3.4:443
<VirtualHost 1.2.3.4:443>
         ServerName www.onesite.com
         ServerAlias onesite.com *.onesite.com
         DocumentRoot /var/www/
# pgAdmin
Alias /phppgadmin /usr/share/phppgadmin/
<Directory /usr/share/phppgadmin/>
         DirectoryIndex index.php
         Options +FollowSymLinks
</Directory>
</VirtualHost>

# end vhost.conf

So, what works as designed:
http://onesite.com
http://twosite.com
https://onesite.com/phppgadmin

What works not and should not work - i.e. throws a 404 error:
http://onesite.com/phppgadmin
http://twosite.com/phppgadmin

What works and should _not_ work:
https://twosite.com/phppgadmin

It seems that the Alias directive is applied to _all_ hosts, not just
the one inside the <VirtualHost .. /> block. From the apache docs:
http://httpd.apache.org/docs/current/mod/mod_alias.html#alias
I read the "context: Virtual host" means it is only effective in the
respective host, but maybe I misunderstood this?
Any hints how to restrict /phppgadmin on the first domain?

/ Bernd

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message