I'm just getting started using Apache and I pretty much have everything configured the way I want, I'm just having trouble with one aspect. A quick overview: I have a document root of "/var/www", then I have two sites at "/var/www/site1" and "/var/www/site2". Both sites have SSL and authenticate using a simple htpasswd file and run on two different ports (443 & 444). Everything works as I would expect, the auth and SSL both work fine. The only problem is that I can access "site2" without a password under certain conditions.
If I browse to "https://10.0.0.13:444/site2" I get the SSL and auth prompt, I can log in and everything works fine. The same goes for "site1", both the SSL and auth work correctly. However if I browse to "https://10.0.0.13/site2", then Apache lets me access "site2" without a password. Both site1 and site2 DNS resolve to the server's IP address. I know it's gotta be something that I'm just not understanding with the vhosts configuration. I've poked around a lot and cannot seem to get it working nor have I found an example online that helps me figure it out either. Any help would be greatly appreciated!! Here is the current "default-ssl" vhost configuration I'm using:
<VirtualHost *:443>
ServerName site1.domain.com
ServerAdmin site1@localhost
SSLEngine on
SSLCertificateFile /etc/apache2/site1.pem
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
<Location /site1>
AuthType Digest
AuthName "site1"
AuthDigestDomain /var/www/site1/ http://site1.domain.com/site1
AuthDigestProvider file
AuthUserFile /etc/apache2/htpasswd
Require valid-user
SetEnv R_ENV "/var/www/site1"
</Location>
</VirtualHost>
<VirtualHost *:444>
ServerName site2.domain.com
ServerAdmin site2@localhost
SSLEngine on
SSLCertificateFile /etc/apache2/site2.pem
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
<Location /site2>
AuthType Digest
AuthName "site2"
AuthDigestDomain /var/www/site2/ http://site2.domain.com/site2
AuthDigestProvider file
AuthUserFile /etc/apache2/htpasswd
Require valid-user
SetEnv R_ENV "/var/www/site2"
</Location>
</VirtualHost>