Hello Everyone, following are the simple steps to configure tomcat to support SSL / https locally.

1. Generate Keystore

First, uses “keytool” command to create a self-signed certificate. During the keystore creation process, you need to assign a password and fill in the certificate’s detail.

anand@anand-Aspire-E1-572:~/apache-tomcat-7.0.42/bin$  keytool -genkey -alias jft -keyalg RSA -keystore /home/anand/jellyfishtechnologies
Enter keystore password:  
Re-enter new password: 
What is your first and last name?
  [Unknown]:  Anand Kushwaha
What is the name of your organizational unit?
  [Unknown]:  JFT
What is the name of your organization?
  [Unknown]:  Jellyfish technologies
What is the name of your City or Locality?
  [Unknown]:  noida
What is the name of your State or Province?
  [Unknown]:  up
What is the two-letter country code for this unit?
  [Unknown]:  in
Is CN=Anand Kushwaha, OU=JFT, O=Jellyfish technologies, L=noida, ST=up, C=in correct?
  [no]:  yes

Enter key password for 
	(RETURN if same as keystore password):  
anand@anand-Aspire-E1-572:~/apache-tomcat-7.0.42/bin$

2. Certificate Details
You can use same “keytool” command to list the existing certificate’s detail.

anand@anand-Aspire-E1-572:~/apache-tomcat-7.0.42/bin$ keytool -list -keystore /home/anand/jellyfishtechnologies
Enter keystore password:  

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 1 entry

jft, 9 Sep, 2014, PrivateKeyEntry, 
Certificate fingerprint (SHA1): E2:6A:E8:68:33:91:09:C3:87:6C:4A:67:0C:5E:CE:F7:09:1B:B3:49
anand@anand-Aspire-E1-572:~/apache-tomcat-7.0.42/bin$ 

3. Connector in server.xml
Next, locate your Tomcat’s server configuration file at $Tomcatconfserver.xml, modify it by adding a connector element to support for SSL or https connection.

File : $Tomcatconfserver.xml


<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" 
	       keystoreFile="/home/anand/jellyfishtechnologies"
	       keystorePass="anand@jft" />

 

4. Thats all 🙂
Saved it and restart Tomcat, access to https://localhost:8443/.
localhost
Hope this helps 🙂 .