Wiki-Quellcode von Bereitstellung über HTTPS
Zeige letzte Bearbeiter
author | version | line-number | content |
---|---|---|---|
1 | Um den Apache Tomcat über HTTPS bereitzustellen, sind Anpassungen an der Datei //server.xml// des Tomcats notwendig. | ||
2 | |||
3 | |||
4 | 1. Öffnen Sie die Datei //server.xml// (Pfad = ///Pfad/Zum/Tomcat/conf/server.xml//) mit einem entsprechenden Texteditor | ||
5 | 1. ((( | ||
6 | Navigieren Sie zu der u.g. Zeile bzw. dem gesamten Eintrag/Block | ||
7 | |||
8 | {{code}} | ||
9 | <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true"> | ||
10 | <SSLHostConfig> | ||
11 | <Certificate certificateKeystoreFile="conf/localhost-rsa.jks" | ||
12 | type="RSA" ></Certificate> | ||
13 | </SSLHostConfig> | ||
14 | </Connector> | ||
15 | {{/code}} | ||
16 | |||
17 | Sollte der entsprechende Block kommentiert sein, so kommentieren Sie diesen aus! | ||
18 | ))) | ||
19 | 1. ((( | ||
20 | Passen Sie den Inhalt an Ihre Gegebenheiten (Pfade/Zertifikate/Port) an. | ||
21 | |||
22 | {{code}} | ||
23 | <Connector port="443" protocol="HTTP/1.1" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" | ||
24 | URIEncoding="UTF-8" | ||
25 | maxHttpHeaderSize="65536" | ||
26 | maxPostSize="10485760" | ||
27 | relaxedQueryChars="[ \ ] ^ ` { | }"> | ||
28 | <SSLHostConfig hostName="XX.XXXX.XX"> | ||
29 | <Certificate certificateKeyFile="conf/private.key" | ||
30 | certificateFile="conf/zertifikat.crt" | ||
31 | certificateChainFile="conf/CHAIN.pem" | ||
32 | type="RSA" ></Certificate> | ||
33 | </SSLHostConfig> | ||
34 | </Connector> | ||
35 | {{/code}} | ||
36 | |||
37 | Weiterführende Informationen zur Konfiguration von der Eigenschaft //SSLHostConfig//: [[https:~~/~~/tomcat.apache.org/tomcat-8.5-doc/config/http.html#SSL_Support_-_SSLHostConfig>>https://tomcat.apache.org/tomcat-8.5-doc/config/http.html#SSL_Support_-_SSLHostConfig]] | ||
38 | |||
39 | **Eine Zusammenfassung der wichtigsten Optionen finden Sie im Folgenden:** | ||
40 | |||
41 | {{table dataTypeAlpha="0" preSort="0-asc"}} | ||
42 | |=Attribut|=Wert|=Beschreibung | ||
43 | |port|443 (Standard)|Über diesen Port wird die Verbindung aufgebaut. | ||
44 | |URIEncoding|UTF-8|UTF-8 ist wichtig für eine durchgängig sauberes Encoding. | ||
45 | |maxHttpHeaderSize|65536|Dieser Wert sollte nicht verändert werden. | ||
46 | |maxPostSize|1100715200|Maximale Größe der Posts (Formulardaten inkl. Datei-Uploads) in Bytes. Der Wert in dem Beispiel ist 1GB. | ||
47 | |hostName|*|Name oder IP Adresse des Hosts. | ||
48 | |certificateKeyFile|*.key|Der private Schlüssel des Zertifikats. | ||
49 | |certificateFile|*.crt|Das eigentliche Zertifikat. | ||
50 | |certificateChainFile|*.*|Das übergeordnete Zertifikat (Certificate Authority (CA)), wenn nötig. | ||
51 | {{/table}} | ||
52 | ))) | ||
53 | |||
54 | **Weitere Möglichkeiten ein Zertifikat im Tomcat am Connector zu konfigurieren:** | ||
55 | |||
56 | Einbindung mittels KeyStore: | ||
57 | |||
58 | {{code}} | ||
59 | <Connector port="443" protocol="HTTP/1.1" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" | ||
60 | URIEncoding="UTF-8" | ||
61 | maxHttpHeaderSize="65536" | ||
62 | maxPostSize="10485760" | ||
63 | relaxedQueryChars="[ \ ] ^ ` { | }"> | ||
64 | <SSLHostConfig> | ||
65 | <Certificate certificateKeystoreFile="conf/file.keystore" | ||
66 | certificateKeystorePassword="mypwd" ></Certificate> | ||
67 | </SSLHostConfig> | ||
68 | </Connector> | ||
69 | {{/code}} | ||
70 | |||
71 | |||
72 | Ist man im Besitz einer KeyPair-Datei (*.pfx, *.p12) kann man diese auch direkt einbinden: | ||
73 | |||
74 | {{code}} | ||
75 | <Connector port="443" protocol="HTTP/1.1" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" | ||
76 | URIEncoding="UTF-8" | ||
77 | maxHttpHeaderSize="65536" | ||
78 | maxPostSize="10485760" | ||
79 | relaxedQueryChars="[ \ ] ^ ` { | }"> | ||
80 | <SSLHostConfig> | ||
81 | <Certificate certificateKeystoreFile="conf/file.pfx" | ||
82 | certificateKeystorePassword="mypwd" | ||
83 | certificateKeystoreType="PKCS12" ></Certificate> | ||
84 | </SSLHostConfig> | ||
85 | </Connector> | ||
86 | {{/code}} |