Httpstomcat need to generate a certificate

Source: Internet
Author: User

a  . Create a tomcat certificate

used here JDK Bring your own Keytool tool to generate the certificate:

1. open keytool.exe under the JDK 's installation directory \bin\keytool.exe

2. Enter the following command at the command line :

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 Name and last name " Should be the domain name, lost to the name, and really run when the domain name does not match, will be problematic

the password I entered here is 123456, domain name is in Tomcat as an example ,   provinces and cities take Xi ' an Shaanxi as an example

two . Configuration Tomcat Server

Locate the installation directory of the Tomcat server and locate the conf Server.xml File

Find the following code that has been commented:

1 <!--
2 <connector port= "8443" protocol= "http/1.1" sslenabled= "true"
3 maxthreads= "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 Keys

three .  Start Tomcat Server

in the IE Input in Browser : https:// the corresponding domain name (consistent with the generated certificate)

Choose to continue browsing this site

We're done here.

Here are some of the problems that other people on the network have and the solutions that you can refer to :

problems encountered :

I was in the process of configuring the problem when I modified the Server.xml after the configuration, start Tomcat Error

1 Org.apache.catalina.core.StandardService initinternal
2Serious: 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)
Ten at Org.apache.catalina.startup.Catalina.load (catalina.java:658)
One at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
At 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)
At 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 be defined when using SSL with APR
At Org.apache.tomcat.util.net.AprEndpoint.bind (aprendpoint.java:507)
At 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

on the Internet to find the next, can be protocol= "http/1.1" replaced by protocol= "Org.apache.coyote.http11.Http11Protocol" , the problem can be solved

Httpstomcat need to generate a certificate

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.