Tomcat configuration HTTPS

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.