Brauche Hilfe bei Apache 2 Konfigurartion

zubi

Mitglied
Habe folgendes Problem und könnte etwas Hilfe brauchen:

Voraussetzungen
- Tomcat Server mit Apache als Proxy.
- Applikation (Website) muss über https:// laufen.
- Haben rund 5 Domainen, aber nur SSL Zertifikat für 1 Domäne,
da für alle Domänen 1 Zertifikat gekauft werden muss und dies
zu teuer ist, machen wir halt redirect permanent auf die SSL Domäne.

Hier die Konfiguration:

CODE
# http
Listen 80
# https
Listen 443

SSLMutex default
SSLRandomSeed startup builtin
SSLSessionCache none

# alt:
# NameVirtualHost 192.168.130.3:80
# neu:
NameVirtualHost *:80

# 1. Virtualhost .com Redirect auf https://www.mydomain.com
<VirtualHost www.mydomain.com:80>
ServerName www.mydomain.com.com:80
ServerAdmin webmaster@mydomain.com
# Redirect auf https
Redirect permanent / https://www.mydomain.com
ErrorLog logs/error.log
CustomLog logs/access.log combined
</VirtualHost>

# 2. Virtualhost .ch Redirect auf https://www.mydomain.com/mandateChange.do?mandate_ctrl=CH:de
<VirtualHost www.mydomain.ch:80>
ServerName www.mydomain.ch:80
ServerAdmin webmaster@mydomain.com
# Direkter Aufruf deutsche Sprache
Redirect permanent / https://www.mydomain.com/mandateChange.do?mandate_ctrl=CH:de
ErrorLog logs/error.log
CustomLog logs/access.log combined
</VirtualHost>

# 3. Virtualhost
<VirtualHost www.mydomain.de:80>
ServerName www.mydomain.de:80
ServerAdmin webmaster@mydomain.com
# Spezialfall, soll zur Zeit auf anderen Server redirected werden
Redirect / http://www.foo.com
# Folgende Zeile: Versucht ein Document Root zu setzen um redirect
# über index.html mit meta redirect
#DocumentRoot C:/Prg/Apache2/htdocs/redirect
ErrorLog logs/error-de.log
CustomLog logs/access.log combined
</VirtualHost>

# 4. Virtualhost .ch Redirect auf https://www.mydomain.com/mandateChange.do?mandate_ctrl=UK:en
<VirtualHost www.mydomain.uk:80>
ServerName www.mydomain.uk:80
ServerAdmin webmaster@mydomain.com
# Direkter Aufruf englische Sprache
Redirect permanent / https://www.mydomain.com/mandateChange.do?mandate_ctrl=UK:en
ErrorLog logs/error.log
CustomLog logs/access.log combined
</VirtualHost>

# 5. Virtualhost Port: 443 https
<VirtualHost 192.168.130.3:443>
ServerName www.mydomain.com:443
ServerAdmin webmaster@mydomain.com
ProxyPass /participant http://localhost:8080/participant
ProxyPassReverse /participant http://localhost:8080/participant
SSLEngine on
SSLCertificateFile conf/ssl/www.mydomain.com.crt
SSLCertificateKeyFile conf/ssl/www.mydomain.com.key
ErrorLog logs/error.log
CustomLog logs/access.log combined
</VirtualHost>



Bei der Eingabe von https://www.mydomain.com läuft alles wie es sollte.
Ebenso wenn http://www.mydomain.com eingegeben wird. (Redirect permanent auf https geht also)

Wenn aber http://www.mydomain.ch oder http://www.mydomain.uk eingegeben wird, dann sollte ja entweder auf https://www.mydomain.com/mandateChange.do?mandate_ctrl=CH:de oder https://www.mydomain.com/mandateChange.do?mandate_ctrl=UK:en redirected werden.
Es wird aber nur auf https://www.mydomain.com redirected. Im error.log finde ich folgenden Eintrag:


CODE [warn] VirtualHost www.mydomain.ch:80 overlaps with VirtualHost www.mydomain.de:80, the first has precedence, perhaps you need a NameVirtualHost directive


oder auch so was


CODE [Mon Feb 21 09:32:29 2005] [warn] NameVirtualHost *:80 has no VirtualHosts

Bzw. das gleiche so wenn httpd.conf so aussieht:


CODE
# alt:
NameVirtualHost 192.168.130.3:80
# neu:
# NameVirtualHost *:80

[Mon Feb 21 09:25:30 2005] [warn] NameVirtualHost 192.168.130.3:80 has no VirtualHosts


Irgendwie scheint meine VirtaulHost Konfiguration nicht so der Hit zu sein. Bin dankbar für Tips & Tricks.

Gruss

Boris Zuberbühler
 
Hallo

Ich würde folgendes ändern:

1. NameVirtualHost *
2. Jeder Vhost wird dann so definiert:
<VirtualHost *>
3. Die Domain, auf welche der vhost hört wird mit Servername definiert:
Servername www.mydomain.com -> kein port, nur den namen
4. der ssl vhost ist dann
<VirtualHost *:443>

Hoffe, das hilft mal ein wenig weiter
Gruss
Roger
 
Thx Roger

Hat geklappt!!!
biggrin.gif


Musste allerdings den VirtualHost für SSL so lassen:

<VirtualHost 192.168.130.3:443>

So hat's nicht geklappt:

<VirtualHost *:443>

Besten Dank nochmal für schnelle und kompetente Hilfe.

Gruss

Boris

 
Zurück
Oben