我正在尝试在Ubuntu 11.10的tomcat 7中添加sslconfiguration,但是它不能正常工作,并且在日志中没有错误。 我在server.xml中添加了这个:
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" keystoreFile="mycertificate.cert" keystorePass="mypass" clientAuth="false" sslProtocol="TLS" />
我也在web.xml中添加了这个:
<security-constraint> <web-resource-collection> <web-resource-name>Protected Context</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <!-- auth-constraint goes here if you requre authentication --> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint>
我也试过其他的港口。 我也尝试redirect,但没有任何工作。
在catalina.out我只得到这个:
Feb 09, 2016 3:50:27 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8443"] Feb 09, 2016 3:50:27 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 665 ms Feb 09, 2016 3:50:27 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Feb 09, 2016 3:50:27 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.21 Feb 09, 2016 3:50:27 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory ROOT Feb 09, 2016 3:51:20 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [52,112] milliseconds. Feb 09, 2016 3:51:20 PM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8443"] Feb 09, 2016 3:51:20 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 52915 ms
在浏览器中,我得到ERR_CONNECTION_TIMED_OUT
我也用curl -vlkL https:// localhost:8081 -对DHE-RSA-AES256-SHA
并且回到tomcat的主页,但是在浏览器不工作
Tomcat需要存储在Java密钥库中的证书。 但是,您已经将keystoreFile设置为一个cert文件。
您需要将您的证书导入到JKS密钥库中,并将keystoreFile参数更改为该文件。
Java带有keytool实用程序。 keytool程序涵盖了你需要处理JKS的一切。 看看这个网站的最常见的任务。