环境:

Tomcat7、CentOS 6/7

摘要说明:

本篇文章主要讲述如何给Tomcat服务器使用.jks证书配置https协议

步骤:

1.生成.jks证书

根据ssl证书生成.jks证书,网络上有在线生成工具如:

链接1 <https://www.myssl.cn/tools/merge-jks-cert.html>

链接2 <https://myssl.com/cert_convert.html>

2.配置.jks证书

在tomcat的server.xml中直接配置443端口:
<Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" keystoreFile="/xxx/xxx/xxx.jks"
keystorePass="xxxx" keyAlias="xxxx"/>
也可分开配置:
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true"> <SSLHostConfig> <Certificate
certificateKeystoreFile="/xxx/xxx/xxx.jks" certificateKeyAlias="xxx"
certificateKeystorePassword="xxx" type="RSA" /> </SSLHostConfig> </Connector>
上述中:

keystoreFile/certificateKeystoreFile:证书地址,可使用绝对路径,也可以配置相对路径

keyAlias/certificateKeyAlias:生成证书时输入的别名

keystorePass/certificateKeystorePassword:生成证书时输入的密钥

友情链接
KaDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:637538335
关注微信