One minute turn on Tomcat HTTPS support

1, modify the configuration file

Open the tomcat/conf/server.xml configuration file and cancel the following configuration note. KeystorePass is the certificate key that you need to manually add to when you create the certificate.

< Connector port= "8443" protocol= "org.apache.coyote.http11.Http11Protocol" maxThreads= "150" SSLEnabled= "true" scheme= "HTTPS" secure= "true" clientAuth= "false" sslProtocol= "TLS" keystorePass= "123456" />

2, create a certificate

Use the keytool command inside the JDK tool class to generate certificates and enter the appropriate information as prompted.

C:/> keytool -genkey -alias HTTPS -keyalg RSA input keystore password: what is your first and last name? [Unknown] test: what is the name of your organizational unit? [Unknown]: what is your name test? [Unknown]: what is the name of your city or regional test? [Unknown]: test in your province / city what is the autonomous region name? [Unknown]: test the unit of two letter country / what is the area code? [Unknown]: Test CN=test, OU=test, O=test, L=test, ST=test, C=test is right? [no]: Y input < https> the key password (and if the keystore password, press enter): enter the new password again:

The key password here is the keystorePass configuration in the configuration file.

Access HTTPS

You can access the HTTPS project through https://localhost:8443/your-project.

This method is only suitable for local open HTTPS testing, the online environment needs to buy a business license certificate, but the principle is the same.
recommended reading

What is Spring Boot?
Spring Boot 2 ways to open the
Spring Boot Starters
Spring Boot starter custom boot Spring Boot pattern
core configuration
Spring Boot
Spring Boot automatic configuration function of actual combat,
Spring Boot Runner principle
Spring Boot – Profile starter different environment configuration

Have you got any success after reading? Share with friends and give more people.

One minute turn on Tomcat HTTPS support