views:

34

answers:

2

I am trying to setup SSL to my web app and followed tutorial (http://techtracer.com/2007/09/12/setting-up-ssl-on-tomcat-in-3-easy-steps/), then hitting http://localhost:8443 returns "unable to connect"

Environment:

Tomcat6, windows 7

Tomcat6 is up and running, http://localhost:8080 displays tomcat page.

Below is the step I took so far:

1. Generate keystore file

C:\Program Files\Java\jdk1.6.0_21\bin>keytool -genkey -alias masatosanssl -keypass masatosanadmin -keystore masatosanssl.bin -storepass
 masatosanadmin

then I answered the questionnaire.

masatosanssl.bin is created and I've moved the file to my webapp dir which is at:

C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\masatosanssl.bin

2. Configuring Tomcat for using the Keystore file

Modify server.xml

Location: C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
        maxThreads="150" scheme="https" secure="true"
        clientAuth="false" sslProtocol="TLS" 
        keystoreFile="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\masatosanssl.bin"
        keystorePass="masatosanadmin" 
               />

Then I restart tomcat and hit https://localhost:8443 returns "cannot display page", I've tried changing server.xml keystoreFile path to relative etc but none seems to work.

What am I missing here?

+1  A: 

Try doing it the way described in the Tomcat documentation.

EJP
I've followed the documentation and generated .keystore file, also somewhat restarting my computer fixed the problem.. I guess somewhat my tomcat restart wasn't working??? Still investigating.
masato-san
+1  A: 

Did you check Tomcat's logs? Failures to start a Connector will typically generate log messages describing exactly why it could not be started.

What does "returns 'cannot display page'" mean? Is the server listening on the port or not? What does curl -I http://localhost:8443/ or telnet localhost 8443 show?

And are you really sure you want to store your keypass file under a publically-accessible directory like webapps/head_first? Typically this file should be stored in a directory where only the user that Tomcat runs under can read it.

matt b