728x90 AdSpace

Saturday, 3 August 2013

Configure Tomcat to support SSL or HTTPS

We will see how to configure Tomcat to support SSl or Https using Keystore command

1.Gegerate Keystore File

Create Key store file using keytool command for self-signed certificate.Follow the steps mentioned below to generate key store file

<$Tomcat-Home>\bin>keytool -genkey -alias javatutorialscorner -keyalg RSA -keystore c:\javatutorialscornerstore
Enter keystore password:
Re-enter new password:
What is your first and last name?
  [Unknown]:  Java Tutorials Corner
What is the name of your organizational unit?


  [no]:  yes

Enter key password for <javatutorialscorner >
        (RETURN if same as keystore password):
Re-enter new password:

Now your keystore file ready to use.you can find your key store file at mentioned location

2.Edit connector in server.xml

you can find your server.xml  at your <tomcat home>/conf folder .
connector in server.xml befor edit
<Connector port="8080" protocol="HTTP/1.1"
               redirectPort="8443" />
server xml _1
Edit port 8080 to 80.If your using port 80 you don’t need to mention port in url
<Connector port="80" protocol="HTTP/1.1"
               redirectPort="8443" />

Add the following content just below the connector for configure your key store file with tomcat
1.keystoreFile - keystore file location
2.keyAlias - alias name given by you
3.keystorePass - password given by you

               <Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               keyAlias="javatutorialscorner" keystoreFile="C:\javatutorialscornerstore" keystorePass="PASSWORD"
               clientAuth="false" sslProtocol="TLS" />
Now your tomcat ready to support SSL/Https.Start tomcat just give https://localhost ,you can see the following warning page
Click I Understand the risk and add exception then it will go to tomcat home page thats it
add exception
tomcat home page

Annamalai Thangaraj

Annamalai is working as Technical Lead in Leading Telecom company with 5+ years experience in Identity and Access Management , Telecom and Networks, BigData, Java, Spring, Struts, Hibernate, AngularJS, and Enterprise Web Application Development.

Website: Java Tutorials Corner

Shop and help us

Flipkart Offer Snapdeal offer Amazon.in offer Amazon.com offer
Newer Post
This is the last post.
  • Blogger Comments
  • Facebook Comments
  • Disqus Comments


Post a Comment

Item Reviewed: Configure Tomcat to support SSL or HTTPS Rating: 5 Reviewed By: Annamalai Thangaraj