我正在按照本教程在 tomcat 中启用 ssl:https ://medium.com/@raupach/how-to-install-lets-encrypt-with-tomcat-3db8a469e3d2
Altough tomcat 最后运行,我无法访问 https,说无法连接。所以我检查了日志,我得到了:
Caused by: java.io.IOException: SSLHostConfig attribute certificateFile must be defined when using an SSL connector
,但我的 certificateFile 定义如您所见:
<Connector port="443"
protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="100"
compression="on"
scheme="https"
SSLEnabled="true"
secure="true"
SSLVerifyClient="none"
SSLProtocol="TLSv1.2"
defaultSSLHostConfigName="test.test">
<SSLHostConfig hostName="test.test">
<Certificate certificateFile="conf/cert.pem" certificateKeyFile="conf/privkey.pem" certificateChainFile="conf/chain.pem" />
</SSLHostConfig>
</Connector>
这些文件存在于 conf/
tomcat 9 文档:https : //tomcat.apache.org/tomcat-9.0-doc/config/http.html 部分 SSLHostConfig 和证书