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:
<$Tomcat-Home>\bin>
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"
connectionTimeout="20000"
redirectPort="8443" />
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"
connectionTimeout="20000"
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
0 comments:
Post a Comment