Configure Tomcat to use the HTTPS protocol

Source: Internet
Author: User

I. Creating a TOMCAT Certificate

This uses the Keytool tool that comes with the JDK 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:

" Tomcat " " RSA " " F:\tomcat.keystore "

Two. Configuring the Tomcat Server

Locate the installation directory for the Tomcat server and locate the Server.xml file under Conf

Find the following code that has been commented:

Remove the comment and modify it to:

    <ConnectorPort= "8443"Protocol= "Org.apache.coyote.http11.Http11Protocol"MaxThreads= "Max"sslenabled= "true"Scheme= "https"Secure= "true"ClientAuth= "false"Sslprotocol= "TLS"Keystorefile= "F:\Keystore\tomcat.keystore"Keystorepass= "123456"/>

Here, the location of the password and certificate is set according to the individual environment, and the attribute parameters are as follows:

Property Describe
ClientAuth If set to True, indicates that Tomcat requires all SSL clients to present a security certificate to authenticate the SSL client
Keystorefile Specifies the location of the KeyStore file, either specifying an absolute path, or specifying a relative path relative to the <CATALINA_HOME> (Tomcat installation directory) environment variable. If this item is not set, by default, Tomcat will read the file named ". KeyStore" from the user directory of the current operating system user.
Keystorepass Specifies the password for the KeyStore, and by default, Tomcat uses "Changeit" as the default password if it is not set.
Sslprotocol Specifies the encryption/decryption protocol used by the socket (socket) and the default value is TLS, which should not be modified by the user.
Ciphers Specifies the list of passwords available for the socket for encryption, separated by commas (,) between multiple passwords. If this item is not set, by default, the socket can use any one of the available passwords.

To access a Web site that supports SSL:

Start this game tomcat and enter it in the browser: https://localhost:8443/

Note:

To access a Web site that supports SSL:

Found SSL does not work, the following information appears:

Err_ssl_version_or_cipher_mismatch

The solution is to modify the Servlet.xml file:

<ConnectorPort= "8443"Protocol= "http/1.1"sslenabled= "true"MaxThreads= "Max"Scheme= "https"Secure= "true"ClientAuth= "false"Sslprotocol= "TLS"Keystorefile= "D:\Tools\Web\ssl\tomcat.keystore"Keystorepass= "Tomcat"Ciphers= "tls_ecdhe_rsa_with_aes_128_cbc_sha256, Tls_ecdhe_rsa_with_aes_128_cbc_sha, tls_ecdhe_ rsa_with_aes_256_cbc_sha384, Tls_ecdhe_rsa_with_aes_256_cbc_sha, tls_ecdhe_rsa_with_rc4_128_ SHA, tls_rsa_with_aes_128_cbc_sha256, Tls_rsa_with_aes_128_cbc_sha, Tls_rsa_w ith_aes_256_cbc_sha256, Tls_rsa_with_aes_256_cbc_sha, Ssl_rsa_with_rc4_128_sha "/>    

Or do not use the Ciphers node property

Configure Tomcat to use the HTTPS protocol

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.