Tomcat to configure HTTPS mode access

Source: Internet
Author: User

1.cmd Command, then execute in the directory of the jdk bin

Keytool-genkey-alias tomcat-keyalg Rsa-keystore F:\tomcat.keystore-validity 36500

Then you will be prompted to fill in the relevant information, the content of the prompt is as follows, fill in the format as follows:

A, enter the keystore password: Here you need to enter a string greater than 6 characters

B, "What is your first and last name?" "This is required and must be the domain name of the Tomcat deployment host or ip[such as: Gbcom.com or 10.1.25.251], which is the access address you will enter in the browser

C, "What is your organizational unit name?" "," What is your organization name? "," What is your city or region name? "," What is the name of your state or province? "," What is the two-letter country code for this unit? "Can be filled in as needed or can not fill in the direct return, the system asked" correct? , enter the letter "Y" with the keyboard if required, otherwise enter "n" to re-fill the information

D, enter <tomcat> master password, this is more important, will be used in the Tomcat configuration file, the recommended input and KeyStore password consistent, set other password can also

2. setting up the Tomcat configuration file

2.1 Setting up Web. xml

Add to

<security-constraint>

<web-resource-collection >

<web-resource-name >SSL</web-resource-name>

<url-pattern>/*</url-pattern>

</web-resource-collection>

<user-data-constraint>

<transport-guarantee>CONFIDENTIAL</transport-guarantee>

</user-data-constraint>

</security-constraint>

The effect is as follows

Modify the inner Server.xml as follows:

<connector port= "protocol=" http/1.1 "

connectiontimeout= "20000"

redirectport= "8443"/>

<connector port= "8443" protocol= "http/1.1" sslenabled= "true"

maxthreads= "Scheme=" "https" secure= "true" usebodyencodingforuri= "true"

Clientauth= "false" sslprotocol= "TLS" keystorefile= "Tomcat.keystore" keystorepass= "123456"/>

<connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/>

if consistent without modification, here's the password to fill in your own password just entered Tomcat,

then put the resulting file Tomcat.keystore under Tomcat, and the Tomcat bin directory at the same level, or write the path directly

3. set the project MF file application-dev.properties

Note If 8843 is not open, the Sever.xml configuration file and application-dev.properties are changed to open ports

Restart Tomcat access Https://localhost:8443/MFS

Tomcat to configure HTTPS mode access

Related Article

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.