Saturday, December 24, 2011

Enabling Https in Tomcat 6.0

This features works in Tomcat 7.0 as well
Steps:-
1.Use keytool tool to generate a keystore  in dos prompt
    C:\>keytool -genkey -alias mytomcat -keyalg RSA
2. A .keystore file will be created under "C:\Documents and Settings\Welcome" folder,
where welcome is your current user

3.Activate https service in your tomcat server,by including .keystore file produced above,in server.xml. These Entries are present in the server.xml,simple enable them and modify keystore file location and password

<Connector port="8443" maxThreads="200" scheme="https" secure="true" SSLEnabled="true"
  keystoreFile="C:\Documents and Settings\Welcome\.keystore"  keystorePass="satya123" 
   clientAuth="false" sslProtocol="TLS"/>                                                                                               

4.If you want you can disable normal Http Service by commenting
<Connector port="8080" protocol="HTTP/1.1"  connectionTimeout="20000" redirectPort="8443"/>

5.Restart the server,and give request to any webapplication using https,It will ask you to save the certificate in your system,and then after you can access the webapplication using https

No comments:

Post a Comment