Setting up SSL (https) on Tomcat

1)JAVA (1.6)
2)Tomcat 5

Step 1 :

Create a keystore file to store the server's private key and self-signed certificate :
Go to %JAVA_HOME%\bin\  and  run below command
keytool -genkey -alias tomcat -keyalg RSA

while excuting the above command, it will ask you some questions. First, it will ask you to create a password (ex :“p1ssw0rd“):
Will create a .keystore file on home directory. On Windows, it will be on: C:\Users\UserName;
Step 2 : 
Configuring Tomcat for using the keystore file – SSL config
Check the Connector Tag and add below code

<Connector SSLEnabled="true" acceptCount="100" clientAuth="false"
    disableUploadTimeout="true" enableLookups="false" maxThreads="25"
    port="8443" keystoreFile="C:/Users/UserName/.keystore" keystorePass=" p1ssw0rd "
    protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https"
    secure="true" sslProtocol="TLS" />

Thats it:
Now type the url (https://localhost:8443/) and test it  :-).

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...