tomcat怎么支持两个ssl链接 tomcat配置ssl

主机教程 建站分享 2年前 (2022-12-01) 180次浏览

文章摘要:tomcat怎么支持两个ssl链接 tomcat配置ssl

tomcat支持两个ssl链接的方法: 打开server.xml配置,代码如下: <?xml  […]

tomcat支持两个ssl链接的方法:

打开server.xml配置,代码如下:

<?xml version="1.0" encoding="UTF-8"?>

<!--  访问 80 重定向到 443 -->

    <Connector port="80" maxHttpHeaderSize="8192" address="0.0.0.0"

               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"

               enableLookups="false" redirectPort="443" acceptCount="100"

               connectionTimeout="20000" disableUploadTimeout="true" /> 

  <!-- 特别注意 defaultSSLHostConfigName 要配置一个默认的访问域名  -->    

    <Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"

               maxThreads="150" SSLEnabled="true" defaultSSLHostConfigName="www.test.a.com">

       <SSLHostConfig hostName="www.test.a.com">

            <Certificate certificateKeystoreFile="D: omcatapache-tomcat-8.5.20cert1a.pfx" certificateKeystorePassword="a的密码"

                         certificateKeystoreType="PKCS12" />

        </SSLHostConfig>

        

        <SSLHostConfig hostName="www.test.b.com">

            <Certificate certificateKeystoreFile="D: omcatapache-tomcat-8.5.20cert2.pfx" certificateKeystorePassword="b的密码"

                         certificateKeystoreType="PKCS12" />

        </SSLHostConfig>

        

       

    </Connector>

 

    <Connector port="8009" protocol="AJP/1.3" redirectPort="443" />

    <Engine name="Catalina" defaultHost="www.test.a.com">

      <Realm className="org.apache.catalina.realm.LockOutRealm">

        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"

               resourceName="UserDatabase"/>

      </Realm>

    <!-- 这里配置的两个域名访问的是同一个 项目  -->

      <Host name="www.test.a.com"  appBase="webapps"

            unpackWARs="true" autoDeploy="true">

            

            <Alias>www.test.a.com</Alias>

            <Alias>www.test.b.com</Alias>

            

        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"

               prefix="localhost_access_log" suffix=".txt"

               pattern="%h %l %u %t "%r" %s %b" />

      </Host>

      

    </Engine>

  </Service>

</Server>


声明:
若非注明,本站文章源于互联网收集整理和网友分享发布,如有侵权,请联系站长处理。
文章名称:tomcat怎么支持两个ssl链接 tomcat配置ssl
文章链接:http://www.7966.org/post/15606.html
转载请注明出处

喜欢 (0)