Apache2 configurationshilfe

Debian macht sich hervorragend als Web- und Mailserver. Schau auch in den " Tipps und Tricks"-Bereich.
Antworten
pcace
Beiträge: 231
Registriert: 28.08.2011 01:08:55

Apache2 configurationshilfe

Beitrag von pcace » 02.08.2021 18:29:31

Hi,

ich fange grad an mich mit der configuration vom Apachen auseinanderzusetzen und habe folgendes Setup:

es läuft eine Mailcow instanz auf dem Server, welche ich per reverseproxy über den apachen aufrufe (webmail.domain.de und mail.domain.de).
dann habe ich noch ein etherpad laufen (pad.domain.de).
zusätzlich will ich eigentlich noch eine simple webseite unter domain.de laufen lassen.

dazu habe ich 3 config dateien in sites_enabled:

index.conf (die webseite domain.de)

Code: Alles auswählen

<VirtualHost *:80>
ServerAdmin mail@domain.de
ServerName domain.de

ServerAlias www.domain.de

Redirect permanent / https://www.domain.de

#ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined


</VirtualHost>
dann habe ich mein etherpad so configuriert:

Code: Alles auswählen

<VirtualHost *:80>
  ServerName pad.domain.de
  RewriteEngine on

  RewriteCond %{HTTPS} off
  RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [R=301,L]

  ProxyPass / http://127.0.0.1:9001/
  ProxyPassReverse / http://127.0.0.1:9001/
  ProxyPreserveHost On
  ProxyAddHeaders On
  RequestHeader set X-Forwarded-Proto "http"
</VirtualHost>
<VirtualHost *:443>
  ServerName pad.domain.de

  # You should proxy to a plain HTTP session to offload SSL processing
  ProxyPass / http://127.0.0.1:9001/
  ProxyPassReverse / http://127.0.0.1:9001/
  ProxyPreserveHost On
  ProxyAddHeaders On
  RequestHeader set X-Forwarded-Proto "https"

  SSLCertificateFile /opt/mailcow-dockerized/data/assets/ssl/cert.pem
  SSLCertificateKeyFile /opt/mailcow-dockerized/data/assets/ssl/key.pem

  # If you plan to proxy to a HTTPS host:
  SSLProxyEngine On

  # If you plan to proxy to an untrusted HTTPS host:
  #SSLProxyVerify none
  #SSLProxyCheckPeerCN off
  #SSLProxyCheckPeerName off
  #SSLProxyCheckPeerExpire off
</VirtualHost>
und die Mailcow so:

Code: Alles auswählen

<VirtualHost *:80>
  ServerName mail.domain.de
  #ServerAlias autodiscover.*
  #ServerAlias autoconfig.*
  RewriteEngine on

  RewriteCond %{HTTPS} off
  RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [R=301,L]

  ProxyPass / http://127.0.0.1:8080/
  ProxyPassReverse / http://127.0.0.1:8080/
  ProxyPreserveHost On
  ProxyAddHeaders On
  RequestHeader set X-Forwarded-Proto "http"
</VirtualHost>
<VirtualHost *:443>
  ServerName mail.domain.de
  #ServerAlias autodiscover.*
  #ServerAlias autoconfig.*

  # You should proxy to a plain HTTP session to offload SSL processing
  ProxyPass /Microsoft-Server-ActiveSync http://127.0.0.1:8080/Microsoft-Server-ActiveSync connectiontimeout=4000
  ProxyPassReverse /Microsoft-Server-ActiveSync http://127.0.0.1:8080/Microsoft-Server-ActiveSync
  ProxyPass / http://127.0.0.1:8080/
  ProxyPassReverse / http://127.0.0.1:8080/
  ProxyPreserveHost On
  ProxyAddHeaders On
  RequestHeader set X-Forwarded-Proto "https"

  SSLCertificateFile /opt/mailcow-dockerized/data/assets/ssl/cert.pem
  SSLCertificateKeyFile /opt/mailcow-dockerized/data/assets/ssl/key.pem

  # If you plan to proxy to a HTTPS host:
  #SSLProxyEngine On

  # If you plan to proxy to an untrusted HTTPS host:
  #SSLProxyVerify none
  #SSLProxyCheckPeerCN off
  #SSLProxyCheckPeerName off
  #SSLProxyCheckPeerExpire off
</VirtualHost>
das problem ist, dass ich unter domain.de immer direkt auf cloud.domain.de weitergeleitet werde und einrfach überhaupt nicht verstehe warum!

Vielleicht sieht ja jemand was da los ist?

gruß und Dank schonmal!!!

pcace
Beiträge: 231
Registriert: 28.08.2011 01:08:55

Re: Apache2 configurationshilfe

Beitrag von pcace » 02.08.2021 18:31:08

ok, das war dumm...

1. coockies löschen,
2. muss natürlich in der index.conf auch ein virtualhost für 443 angegeben sein:

Code: Alles auswählen

<VirtualHost *:80>
ServerAdmin mail@domain.de
ServerName domain.de

ServerAlias www.domain.de

Redirect permanent / https://www.domain.de

#ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:443>
ServerName www.domain.de
DocumentRoot /var/www/html
SSLEngine On
SSLCertificateFile /opt/mailcow-dockerized/data/assets/ssl/cert.pem
SSLCertificateKeyFile /opt/mailcow-dockerized/data/assets/ssl/key.pem
</VirtualHost>
funktioniert.
Kann geschlossen werden ;/ Sorry

Antworten