Thursday, November 21, 2013

Tomcat 6 https / SSL Installation with Self-signed Certificate

Generate Keystore File

  1. RUN
    "C:\Program Files\Java\jdk1.6.0_45\bin\keytool" -genkey -alias tomcat -keyalg RSA -keystore c:\tomcatkeystore
    OR RUN
    "C:\Program Files\Java\jre7\bin\keytool" -genkey -alias tomcat -keyalg RSA -keystore c:\tomcatkeystore
  2. Input keystore password: changeit
  3. Input password again: changeit
  4. Input name: Andy Jackson
  5. Input organizational unit: HR Department
  6. Input organization name: Soho Bussiness Ltd
  7. Input city: Guangzhou
  8. Input province: Guangdong
  9. Input country code: CN
  10. Confirm submission: Y
  11. Tomcat password: changeit
  12. Tomcat password again: changeit
  13. The keystore file will be located at c:\tomcatkeystore

Config tomcat (C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\server.xml)

Input the following code to server.xml

<Connector protocol="org.apache.coyote.http11.Http11Protocol"
            port="443" minSpareThreads="5" maxSpareThreads="75"
            enableLookups="true" disableUploadTimout="true"
            acceptCount="100"  maxThreads="200"
            scheme="https" secure="true" SSLEnabled="true"
            clientAuth="false" sslProtocol="TLS"
            keystoreFile="c:\tomcatkeystore"
            keystoreType="JKS" keystorePass="changeit"    />

Testing

Go to https://localhost with your default browser