码迷,mamicode.com
首页 > Web开发 > 详细

tomcat绑定两个https域名

时间:2020-01-08 00:12:42      阅读:103      评论:0      收藏:0      [点我收藏+]

标签:timeout   max   text   access   http   efi   pac   fine   apach   

配置server.xml文件
域名访问先修改成80端口,然后是redirectPort为443

<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443" />
配置SSL证书

<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" URIEncoding="UTF-8" defaultSSLHostConfigName="www.xxxx.com">

<!--配置证书路径,密码-->
<SSLHostConfig hostName="www.xxxx1.com" caCertificateFile="cert/www.xxxx.com.pem">
<Certificate certificateKeystoreFile="cert/www.xxxx1.com.pfx"
certificateKeystoreType="PKCS12" certificateKeystorePassword="***" />
</SSLHostConfig>

<SSLHostConfig hostName="www.xxx2.com" caCertificateFile="cert/www.xxxx2.com.pem">
<Certificate certificateKeystoreFile="cert/www.xxxx2.com.pfx"
certificateKeystoreType="PKCS12" certificateKeystorePassword="***" />
</SSLHostConfig>
</Connector>

修改redirectPort为443

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="443" />

一个项目对应多个域名

<Host name="www.xxxx1.com" appBase="webapps" unpackWARs="false"
autoDeploy="true" defaultHost="www.xxxx1.com">
<!--多个域名别名-->
<Alias>www.xxx1.com</Alias>
<Alias>www.xxxx2.com</Alias>
<!--默认项目访问路径-->
<Context path="" docBase="项目地址" reloadable="false" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>

多个项目需要配置多个host,其中需要注意每个host下默认项目访问路径

<Engine name="Catalina" defaultHost="www.xxxxx1.com">
<Host name="xxxxx1.com" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!--默认项目访问路径-->
<Context path="" docBase="项目地址" reloadable="true" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>

<Host name="www.xxxxxx2.com" appBase="项目地址"
unpackWARs="true" autoDeploy="true">
<!--默认项目访问路径-->
<Context path="" docBase="project2" reloadable="true" />
<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>

tomcat绑定两个https域名

标签:timeout   max   text   access   http   efi   pac   fine   apach   

原文地址:https://blog.51cto.com/11657004/2465123

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!