Tomcat配置ssl证书(.jks)实现HTTPS

环境:

Tomcat7、CentOS 6/7

摘要说明:

本篇文章主要讲述如何给Tomcat服务器使用.jks配置https正式

步骤:

1.生成.jks证书

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

链接1

链接2

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:生成证书时输入的密钥

猜你喜欢

转载自blog.csdn.net/u010904188/article/details/80966515