我正在尝试在 ubuntu 11.10 中的 tomcat 7 中添加 ssl 配置,但它不起作用,并且日志中没有错误。我在 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>
我也尝试过其他端口。我也尝试过重定向,但没有任何效果。
在 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 -vlkLhttps://本地主机:8081--密码 DHE-RSA-AES256-SHA
它返回 tomcat 的主页,但它在浏览器中不起作用