Tomcat支持两个ssl链接的方法:打开server.xml配置,代码如下:<?xml version="1.0" encoding="UTF-8"?><!--
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:\tomcat\apache-tomcat-8.5.20\cert\1\a.pfx" certificateKeystorePassWord="a的密码"
certificateKeystoreType="PKCS12" />
</SSLHostConfig>
<SSLHostConfig hostName="www.test.b.com">
<Certificate certificateKeystoreFile="D:\tomcat\apache-tomcat-8.5.20\cert\2\b.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>
--结束END--
本文标题: tomcat怎么支持两个ssl链接
本文链接: https://lsjlt.com/news/114978.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0