Apache2 subdomains zeigen falschen Inhalt

<Cyclonit>

Ensign
Registriert
Mai 2011
Beiträge
137
Hi,

ich verzweifle gerade daran die subdomains meines Servers richtig zu konfigurieren und hoffe, dass mir hier jemand helfen kann. Hier zunächst mal die beiden .conf dateien:

phpmyadmin.domain.conf
<VirtualHost *:80>

ServerName phpmyadmin.domain.com
ServerAlias www.phpmyadmin.domain.com

Redirect permanent / https://phpmyadmin.domain.com/

<Directory /usr/share/phpmyadmin>
Order Deny,Allow
Deny from All
</Directory>

#logs
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/phpmyadmin_domain_80_error.log
CustomLog ${APACHE_LOG_DIR}/phpmyadmin_domain_80_access.log combined

</VirtualHost>

<VirtualHost *:443>

ServerName phpmyadmin.domain.com
ServerAlias www.phpmyadmin.domain.com

DocumentRoot /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php

<IfModule mod_php5.c>
AddType application/x-httpd-php .php

php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_value include_path .
</IfModule>
</Directory>

# setup
<Directory /usr/share/phpmyadmin/setup>
<IfModule mod_authn_file.c>
AuthType Basic
AuthName "phpMyAdmin Setup"
AuthUserFile /etc/phpmyadmin/htpasswd.setup
</IfModule>
Require valid-user
</Directory>

# locked directories
<Directory /usr/share/phpmyadmin/libraries>
Order Deny,Allow
Deny from All
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
Order Deny,Allow
Deny from All
</Directory>

#logs
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/phpmyadmin_domain_443_error.log
CustomLog ${APACHE_LOG_DIR}/phpmyadmin_domain_443_access.log combined

#ssl
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key

</VirtualHost>

phpldapadmin.domain.conf
# Define /phpldapadmin alias, this is the default
<IfModule mod_alias.c>
Alias /phpldapadmin /usr/share/phpldapadmin/htdocs
</IfModule>

<VirtualHost *:80>

ServerName phpldapadmin.domain.com
ServerAlias www.phpldapadmin.domain.com

Redirect permanent / https://phpldapadmin.domain.com/

#logs
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/phpldapadmin_domain_80_error.log
CustomLog ${APACHE_LOG_DIR}/phpldapadmin_domain_80_access.log common

</VirtualHost>

<VirtualHost *:443>

ServerName phpldapadmin.domain.com
ServerAlias www.phpldapadmin.domain.com

DocumentRoot /usr/share/phpldapadmin/htdocs/

#logs
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/phpldapadmin_domain_443_error.log
CustomLog ${APACHE_LOG_DIR}/phpldapadmin_domain_443_access.log combined

#ssl
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key

</VirtualHost>

<Directory /usr/share/phpldapadmin/htdocs/>

DirectoryIndex index.php
Options +FollowSymLinks
AllowOverride None

Order allow,deny
Allow from all

<IfModule mod_mime.c>

<IfModule mod_php5.c>
AddType application/x-httpd-php .php

php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_value include_path .
</IfModule>

<IfModule !mod_php5.c>
<IfModule mod_actions.c>
<IfModule mod_cgi.c>
AddType application/x-httpd-php .php
Action application/x-httpd-php /cgi-bin/php5
</IfModule>
<IfModule mod_cgid.c>
AddType application/x-httpd-php .php
Action application/x-httpd-php /cgi-bin/php5
</IfModule>
</IfModule>
</IfModule>

</IfModule>

</Directory>

So stelle ich mir das Verhalten von apache derzeitig vor:

1. Request für http://phpmyadmin.domain.com kommt rein.
2. Keine .conf hat wildcards, also müsste http://phpmyadmin.domain.com korrekt ausgewählt werden.
3. Es wird auf die HTTPS-Seite weitergeleitet -> https://phpmyadmin.domain.com
4. Request für https://phpmyadmin.domain.com kommt rein
5. Wieder existieren keinerlei Wildcards, also müsste https://phpmyadmin.domain.com korrekt ausgewählt werden.
6. Der Client befindet sich nun korrekt im Verzeichnis /usr/share/phpmyadmin

Dies scheint auch richtig zu funktionieren. Allerdings läuft bei Schritt 6 folgendes auf der anderen Subdomain (phpldapadmin.domain.com) falsch:

Ohne Weiterleitung (URL im Browser zeigt korrekt https://phpldapadmin.domain.com) wird der Inhalt der Adresse https://phpmadmin.domain.com angezeigt. Auf den eigentlichen Inhalt von phpldapadmin kann daher nicht zugegriffen werden.


Ich hoffe das ist soweit verständlich und mir kann jemand helfen.

Cyclonit
 
Meine sites-enabled enthält folgende links:

000-cn.domain.com -> ../sites-available/cn.domain.conf
001-phpmyadmin.domain.com -> ../sites-available/phpmyadmin.domain.conf
002-phpldapadmin.domain.com -> ../sites-available/phpmyadmin.domain.conf
003-default -> ../sites-available/default.conf

Edit: Ein Ändern der Reihenfolge ändert außerdem garnichts. phpmyadmin überschreibt weiterhin phpldapadmin. Selbst wenn es als letztes geladen wird.
 
nicht wirklich. ich versteh nicht, wie a2ensite 2 verschiedene Symlinks auf ein- und dieselbe Quelldatei anlegt, anstatt jeweils einen Symlink für eine Datei.

Eine Sache macht mich grad stutzig: Gehört <Directory> nicht in <VirtualHost> rein? Bei der LDAP-Config isses außerhalb... das kommt mir irgendwie falsch vor.
 
Zurück
Oben