Searching...
Friday, 8 November 2013

How to configure SSL/HTTPS in Tomcat ?

10:37

Follow below simple two steps in enable SSL in your tomcat server. Generally to enable SSL we required certificate, in this example we are using our own key.  We can use Java keytool.exe  (Java\jdk1.7.0_06\bin\keytool.exe) to generate certificate.

Use below command to generate keys

keytool -genkey -alias pretech -keyalg RSA -keystore c:\vinod

Option details:

-genkey= Generate keys

-alias= Giving unique alias for keystore

-keyalg= To define algorithm (eg RSA_

-keystore=Location to store certificate

Step1 - Generate Key

image

Step 2- Configure Tomcat Server.xml

Replace connector details in your tomcat\conf\server.xml

	<Connector port="8080" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" 
         keystoreFile="c:\vinod"
         keystorePass="xxxxxx" />

Note: Replace kestorePass  xxxxxx with your password which is used during key generation.

Start tomcat


Start your tomcat server and check the admin console with https. We can see SSL is enabled.


image

0 comments: