This tutorial shows how to enable SSL support for Apache Tomcat web server.

Requirement

  • Apache Tomcat 5.0
  • JDK 1.5

Note: if you have JDK below 1.4, you need to install Java Secure Socket Extensions (JSSE)

Step-by-step

  1. Create .ketstore file
    • Enter command line and change directory to your JAVA\bin folder. (Default path is: C:\Program Files\Java\jre1.5.0_12\bin)
    • Type “keytool –genkey –alias tomcat –keyalg RSA and press Enter.
      Where tomcat is an alias name and RSA is a key algorithm.
    • Type your password for the keystore. (Default password is: changeit). In this example, I’ll use password as “password�?.
    • Enter general information about this Certificate. The example is the image below. In the last line, Enter key password for (tomcat) should be the same as you enter before.
      Note that this information will be displayed to users who attempt to access a secure page.
      Enter certificate description
    • The file .keystore will be created on your account. (Currently, I use administrator account so it’ll be in C:\Documents and Settings\Administrator)
      The .keystore file
  2. Configure Tomcat
    • Open server.xml in Tomcat\conf folder. (Default path is: C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf)
    • Uncomment the paragraph below this line
      <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->.<br /> (By removing <!-- and --> tags below the line)
    • Add new attribute keystorePass=”password” to the Connector element. If you haven’t change keystore’s password, you don’t have to add this attribute.
      Edit tomcat's configuration file
    • Change port to 443 if you want to access a page from https:// without specifies port after hostname.
      Change ssl port
    • Save and restart Apache Tomcat service.
  3. Test the result
    • Open browser and navigate to the Apache Tomcat server with https:// prefix
      Try access tomcat's default page
    • There will be a pop-up window show about security alert, click Yes.
      Secrity alert about certificate
    • When you see Apache Tomcat’s default page, that’s means you have success enable SSL on the server. Congratulate.
    • Also, you will notice there is a key icon on the bottom right of your browser.
      Access tomcat's default page on secure port
    • Try double click on the key to view certificate’s detail.
      View the certificate
Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • description
  • ThisNext
  • MisterWong
  • Wists
  • BlinkList
  • Fark
  • Fleck
  • Furl
  • Reddit
  • Slashdot
  • SphereIt
  • StumbleUpon
  • Technorati
  • Blue Dot
  • description
  • MyShare
  • Spurl
  • YahooMyWeb

Related post