Tuesday, January 12, 2021

Hosting multiple virtual host with multiple SSL certificate in Tomcat

Description: Here I explained, how to host virtual site with multiple SSL certificates in tomcat

We are going to set up a virtual host with multiple SSL certificates with a different domain name like as follow

  • site1.com
  • testsite1.com

In Tomcat SSL configuration defined in <Connector> element on server.xml or config.xml. In the example already site1.com host with default port number 80 and 443.

First, we need to create CSR and get SSL from a certificate authority using below URL

https://servertecholab.blogspot.com/2018/02/ssl-certificate-installation-tomcat.html

Now to set up a virtual host for testsite1.com first need to set up an additional port on connector with created .jks and Host with the site name 

<Connector port="443" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslEnabledProtocols="TLSv1,TLSv1.1,TLSv1.2" keyAlias="server" keystoreFile="E:\sites\site1.com.jks" keystorePass="Password" connectionTimeout="20000" />
Connector port="9443" maxThreads="150" SSLEnabled="true" scheme="https" secure="true clientAuth="false" sslEnabledProtocols="TLSv1,TLSv1.1,TLSv1.2" keyAlias="ERP" keystoreFile="E:\sites\testsite1.jks" keystorePass="Password" connectionTimeout="20000" /> <Host name="testsite1.com" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Alias>testsite1.com</Alias> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="tapasyaedu_access_log" suffix=".txt" pattern="%h %l %u %t %r %s %b" /> <Context path="" docBase="E:\sites\webapps\testsite1" debug="0" reloadable="true"/> </Host>

After adding above content save the configuration file and restart tomcat. Once tomcat restarted try to browse the site using https://testsite1.com:9443


No comments:

Post a Comment