Http://www.cnblogs.com/wanghaoyuhappy/p/5267702.html
I. Creating a TOMCAT Certificate
Here you use the Keytool tool with the JDK to generate certificates:
1. Open the Keytool.exe under the JDK installation directory \bin\keytool.exe
2. At the command line, enter the following command:
Keytool-genkeypair-alias "Tomcat"-keyalg "RSA"-keystore "G:\tomcat.keystore"
The above command will produce a pair of asymmetric keys and self-signed certificates G:\tomcat.keystore
Note: "First and last name" should be the domain name, lost into the name, and the real run when the domain name does not match, there will be problems
Here I entered the password is 123456, the domain name is tomcat for example, provinces and cities in Shenzhen, Guangdong province as an example
Two. Configure Tomcat server
Navigate to the installation directory of the Tomcat server and locate the Server.xml file under Conf
Locate the following code that has been commented:
1 <!--
2 <connector port= "8443" protocol= "http/1.1" sslenabled= "true"
3 maxthreads= "150" Scheme= "https" secure= "true"
4 clientauth= "false" sslprotocol= "TLS"/>
5 -->
Remove the comment and modify it to:
1 <connector port= "8443" protocol= "http/1.1" sslenabled= "true"
2 maxthreads= "scheme=" https "secure=" True "
3 clientauth=" false "sslprotocol=" TLS "
4 keystorefile=" G:\tomcat.keystore "
5 keystorepass= "123456"/>
On the Internet, the default port for HTTP protocol is 443, and the default port for HTTPS is 443.
Three. Start Tomcat server
Enter in IE browser: https://localhost
Choose to continue browsing this site
It's done!!!!
The problems encountered:
I was in the process of configuring the problem, when I modified the Server.xml configuration, start the Tomcat error
1 Org.apache.catalina.core.StandardService initinternal 2 serious: Failed to initialize connector [connector[http/1.1-443]] 3 org.apache.catalina.LifecycleException:Failed to initialize component [connector[http/1.1-443]] 4 at Org.apache.catalina.util.LifecycleBase.init (lifecyclebase.java:106) 5 at Org.apache.catalina.core.StandardService.initInternal (standardservice.java:559) 6 at Org.apache.catalina.util.LifecycleBase.init (lifecyclebase.java:102) 7 at Org.apache.catalina.core.StandardServer.initInternal (standardserver.java:814) 8 at Org.apache.catalina.util.LifecycleBase.init (lifecyclebase.java:102) 9 at Org.apache.catalina.startup.Catalina.load (catalina.java:633) at Org.apache.catalina.startup.Catalina.load ( catalina.java:658 at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native method) Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:57) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43) at Java.Lang.reflect.Method.invoke (method.java:606) at Org.apache.catalina.startup.Bootstrap.load (bootstrap.java:281) Org.apache.catalina.startup.Bootstrap.main (bootstrap.java:455) caused by: Org.apache.catalina.LifecycleException:Protocol Handler initialization failed at Org.apache.catalina.connector.Connector.initInternal (connector.java:983) at Org.apache.catalina.util.LifecycleBase.init (lifecyclebase.java:102) 20 ...
More caused By:java.lang.Exception:Connector attribute sslcertificatefile must is defined when using SSL with APR At Org.apache.tomcat.util.net.AprEndpoint.bind (aprendpoint.java:507) Org.apache.tomcat.util.net.AbstractEndpoint.init (abstractendpoint.java:610) at Org.apache.coyote.AbstractProtocol.init (abstractprotocol.java:429) at Org.apache.catalina.connector.Connector.initInternal (connector.java:981) 26 ... More
Search on the Internet, you can replace the protocol= "http/1.1" to Protocol= "Org.apache.coyote.http11.Http11Protocol", the problem can be resolved
Four. Install the Tomcat certificate in the browser
Here the browser displays a certificate error with a red warning
Right-click the Select property in the browser to view the certificate
Here I created a new hello.html page in Tomcat's root directory in order to export the certificate.
The following can be accessed to the
Export the certificate to
Note: This place has a part of the computer's "Copy File" button is not point, can not lead out
Can try to install a virtual machine to try
The next step is the following.
I exported the certificate to the desktop,
Got a certificate file for a CER
The following opens the browser's Internet Options----> Content----> Certificates
Select the Trusted Root certification authority----> Import Certificate
Import the generated certificate in
The rest of the steps go directly to the next step
Reboot the browser and find that there is no red warning------!!!
Get!!!