Tomcat – Can’t connect to localhost on port 8443 for tomcat https

httpskeystoretomcattomcat7

I've installed tomcat and it is running perfectly fine.

However, I can't access it via https layer.

Port 8080 works fine:

curl -IL http://localhost:8080
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=ISO-8859-1
Transfer-Encoding: chunked
Date: Sat, 27 Apr 2013 16:20:23 GMT

Port 8443 doesn't respond:

curl -IL https://localhost:8443
curl: (7) couldn't connect to host

This line is uncommented in my server.xml

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" 
 maxThreads="150" scheme="https" secure="true" clientAuth="false" 
 sslProtocol="TLS"
 keystoreFile="/usr/me/.keystore" 
 keystorePass="somepwd" />

I've even changed the protocol to "org.apache.coyote.http11.Http11Protocol" but that hasn't helped either.

I have restarted the tomcat service after every change but yet:

curl https://localhost:8443
curl: (7) couldn't connect to host

My tomcat version is 7.0.39

I've generated my .keystore file with this command keytool -genkey -alias tomcat -keyalg RSA

Best Answer

Changed you settings like below and it should work

  <!-- SSL Port 8443 --> 
  <Connector port="8443" 
  maxThreads="150" scheme="https" secure="true" 
  SSLEngine="on" 
  SSLCertificateFile="mycert.crt" 
  SSLCertificateKeyFile="mykey.pem" 
  SSLPassword="....." 
  clientAuth="false" sslProtocol="TLS"/> 
Related Topic