tomcat如何配置ssl?

打开服务器tomcat安装目录\conf\server.xml文件,找到如下代码:

<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>

把整块注释掉,改成如下代码:

<Connector port="443" protocol="org.apache.coyote.http11.Http11Nio2Protocol" defaultSSLHostConfigName="www.dalink.cn" maxThreads="150" SSLEnabled="true" >
<SSLHostConfig hostName="www.dalink.cn">
<Certificate certificateKeystoreFile="C:\tomcat-8.5.30\conf\cert\dalink.cn \1776821_www.dalink.cn.jks" certificateKeystorePassword="6n1HOwH6" type="RSA" />
</SSLHostConfig>
<SSLHostConfig hostName="www.servor.cn">
<Certificate certificateKeystoreFile="C:\tomcat-8.5.30\conf\cert\servor.cn \1776302_www.servor.cn.jks" certificateKeystorePassword="se1CNN15" type="RSA" />
</SSLHostConfig>
</Connector>

说明:其中C:\tomcat-8.5.30\conf\cert\dalink.cn \1668.jks,C:\tomcat-8.5.30\conf\cert\servor.cn \1766n.jks为证书路径及文件名。改成你自己的。

发表评论
加载中...

相关文章