我有一个在tomcat上运行的web应用程序。现在我想强制使用https。我收到了3个文件,我将它们保存在tomcat/conf/目录下:localhost-rsa-cert.pem、localhost-rsa-chain.pem和localhost-rsa-key.pem。
我修改了server.xml,使未注释的连接器看起来像这样,并重新启动了tomcat。我只能通过...com:8080访问我的页面,而不能通过...com:8443访问。问题出在哪里?
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
maxThreads="150" SSLEnabled="true" >
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
<SSLHostConfig>
<Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
certificateFile="conf/localhost-rsa-cert.pem"
certificateChainFile="conf/localhost-rsa-chain.pem"
type="RSA" />
</SSLHostConfig>
</Connector>
我了解到您需要在web.xml中进行一些更改。