Software list:
Tomcat version: Apache-tomcat-7.0.78-windows-x64.zip
JDK version: 1.8.0_31-b13
1. Configuring Tomcat Users
Open the Tomcat-users.xml file in the Conf file in the Tomcat installation directory
Add a new record (note added in the middle of "/tomcat-users"):
The user must be Tomcat, record the password follow-up will be used!!
1 < password= "521XYBF" roles= "" username= "Tomcat" />
inserting Tomcat user code
2. Generate Tomcat.keystore
To execute cmd, switch to the Tomcat installation directory bin to execute the following command:
1 keytool-genkeypair-alias "Tomcat"-keyalg "RSA"-keystore "F:\tomcat.keystore"
Execute Command
Keytool-genkeypair-alias "Tomcat"-keyalg "RSA"-keystore "D:\tomcat.keystore" (last directory modifiable)
Note: The name and surname are the IP addresses, and the Tomcat key password refers to the password in the previous Tomcat user Configuration.
The file will be generated in the corresponding directory after execution is completed:
3. Modify Tomcat's server.xml to add the HTTPS configuration in Tomcat
Open the Tomcat-users.xml file in the Conf file in the Tomcat installation directory
1 <connector port= "8080" protocol= "http/1.1"2 connectiontimeout= "20000"3 Redirectport = "8443"/>
Modify the Pre-server.xml configuration
1 <connector port= "8443" protocol= "Org.apache.coyote.http11.Http11Protocol" sslenabled= "true" 2 enablelookups= "false"3 acceptcount= "disableuploadtimeout=" true "4 maxthreads = "Scheme=" "https" secure= "true" 5 clientauth= "false" sslprotocol= "TLS" 6 keystorefile= "D:/java/tomcat/tomcat.keystore" 7 keystorepass= "123456"/>
server.xml configuration after modification
Keystorefile The path of the file generated for the first step, Secret Keystorepass for Key Store password in the first step
4. Restart Tomcat to access the project to see HTTPS
Access Address: Note the port number 8443
https://127.0.0.1:8443/Https/
Annex for the modified Server.xml and Tomcat-users.xml, click here to download.
Tomcat download Click here for JDK download click here.
Tomcat configuration HTTPS