SSL-Zertifikat, bestehend aus .CRT und .KEY-Dateien, in XAMPP bzw. Apache installieren.
Inhaltsverzeichnis
Vorarbeiten
- SSL-Zertifikat mit .crt und ggf. SSL-Zertifikatkey mit .key
- Kurzes Wartungsfenster für Apache-Neustart planen
Apache SSL-Konfiguration
Wurden virtuelle Hosts konfiguriert, die über unterschiedliche SSL-Zertifikate verfügen sollen, empfehle ich den Beitrag „HTTPS mit Virtual Hosts in XAMPP nutzen„.
In C:\xampp\apache\conf\extra\httpd-ssl.conf wird auf die selbstgenerierten Zertifikatsdateien verwiesen:
# Server Certificate:
# Point SSLCertificateFile „conf/ssl.crt/server.crt“
# the certificate is encrypted, then you will be prompted for a
# pass phrase. Note that a kill -HUP will prompt again. Keep
# in mind that if you have both an RSA and a DSA certificate you
# can configure both in parallel (to also allow the use of DSA
# ciphers, etc.)
# Some ECC cipher suites (http://www.ietf.org/rfc/rfc4492.txt)
# require an ECC certificate which can also be configured in
# parallel.
SSLCertificateFile „conf/ssl.crt/server.crt“# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you’ve both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
# ECC keys, when in use, can also be configured in parallel
SSLCertificateKeyFile „conf/ssl.key/server.key“
Wie in der CONF-Datei beschrieben, kann auf die separate Private Key Datei verzichtet werden, wenn dieser bereits in der Zertifikatsdatei .crt enthalten ist.
Eigenes SSL-Zertifikat in XAMPP installieren
- Bisherige .CRT- und .KEY-Dateien umbenennen oder verschieben
- Eigene .CRT- und .KEY-Dateien in die Verzeichnisse verschieben
- Apache Neustart durchführen
Gegebenenfalls muss in der Windows Firewall noch der HTTPS-Port 443 freigeschaltet werden.
HTACCESS: HTTP-Anfragen auf HTTPS weiterleiten
Zu guter Letzt, kann noch im htdocs-Ordner eine .htaccess-Datei für die HTTP- auf HTTPS-Weiterleitung platziert werden. In der .htaccess-Datei genügt folgendes:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
Code-Sprache: JavaScript (javascript)