Dec 10
This post explains step by step actions to enable SSL in Tomcat
- Generate an RSA key for signing the certificate:
openssl genrsa -out key.pem 2048
- Generate a certificate using the new key:
openssl req -new -x509 -key key.pem -out cert.pem -days 365
Answer the quesstions with your name, organization name, e-mail, etc.
- Since the certificate is in PEM format, convert it to PKCS12 for Tomcat:
openssl pkcs12 -export -in cert.pem -inkey key.pem -out cert.p12 -name tomcat
Enter a password, don’t leave it blank.
- Edit $TOMCAT_HOME/conf/server.xml and modify the SSL connector:
<Connector port="8443" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" acceptCount="100" debug="0" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreType="PKCS12" keystoreFile="conf/cert.p12" keystorePass="password"/>Remember to change password with the one typed at 3.
Note: DON’T use a self-signed certificate in a PRODUCTION SITE! Contact with a CA to sign your certificate.


January 16th, 2009 at 8:18 pm
Great post, can you publish a part II? where you will explain the clientAtuh. please….
January 22nd, 2009 at 12:42 pm
It shows page cannot be displayed as i followed your step
August 23rd, 2009 at 8:29 pm
this tutorial is bogus, it aint gonna work!
August 23rd, 2009 at 10:03 pm
@amit bohra
It may be obsolete (I don’t know…) but it really works with Tomcat 5.5.
Can you instruct us?
August 27th, 2009 at 10:09 pm
step 4 – you need to specify the following things to tomcat / server.xml
1. private key file
2. copy root CA certificate to the conf directory
otherwise if you try to access tomcat with https://sitename.com it will show a 404 error!
August 27th, 2009 at 10:12 pm
visit this page for more information guys –
http://thilinag.blogspot.com/2008/02/setting-up-https-in-apache-tomcat-using.html
August 28th, 2009 at 2:28 am
@amit bohra
Totally agree with you. I forgot about writing these steps, I’ll update the post with you observations as soon as I have five mins.
I’m sorry if I was rude in my first comment.
Thanks for your comments .