简体   繁体   中英

Create ssl certificate for java website running on Tomcat server

I have recently signed up on Cloudflare.com for ssl connection. But I don't have any idea how to install ssl certificate on my java website running on Tomcat server. So can anyone please show me step by step how to activate ssl on my java website.

  1. Use keytool to create a keystore

    keytool -genkey -alias server -keyalg RSA -keysize 2048 -keystore your_site_name.jks

this will prompt you to create a password, do not forget it.

  1. Install the certificate

    keytool -import -trustcacerts -alias server -file cert.p7b -keystore your_site_name.jks

If asked to trust the certificate, choose yes (y).

  1. Configure your SSL connector

open server.xml in a text editor. This file is commonly located in the conf folder of the Tomcat server's home directory.

Locate the connector with port 443 and uncomment it.

Specify the keystore file name and password.

It should look something like this:

<Connector port="443" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" SSLEnabled="true" clientAuth="false" sslProtocol="TLS" keyAlias="server" keystoreFile="/home/user_name/your_site_name.jks" keystorePass="your_keystore_password" />

Now save your changes and restart tomcat!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM