You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael Osipov <mi...@apache.org> on 2021/11/08 15:36:34 UTC

Mimicking two distinct virtual hosts just like in HTTPd

Folks,

consider the following in httpd.conf:

Listen {IP}:8443
Listen {IP}:8444

later:
<Virtualhost {IP}:8443>
   DocumentRoot /www/webapps1
   ServerName {hostname}
   mod_ssl config...
</VirtualHost>
<Virtualhost {IP}:8444>
   DocumentRoot /www/webapps2
   ServerName {hostname}
   mod_ssl config2...
</VirtualHost>

The second virtual host shall deliver only a subset of webapps1, but 
configured client cert auth to avoid issues with PHA and renotiation.

Now, I am looking for the same in Tomcat. Given that I have one Server, 
one Service, two Connectors one Engine and two Hosts there is no way to 
bind a Host in Tomcat to an listen address, but only to a hostname/IP 
address.
 From my understanding of the server.xml I would need set up *two* 
Service elements with one Engine, Connector and Host each.

Is my understanding correct?

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Mimicking two distinct virtual hosts just like in HTTPd

Posted by Michael Osipov <mi...@apache.org>.
Am 2021-11-08 um 17:36 schrieb Mark Thomas:
> On 08/11/2021 15:36, Michael Osipov wrote:
>> Folks,
>> 
>> consider the following in httpd.conf:
>> 
>> Listen {IP}:8443
>> Listen {IP}:8444
>> 
>> later:
>> <Virtualhost {IP}:8443>
>>    DocumentRoot /www/webapps1
>>    ServerName {hostname}
>>    mod_ssl config...
>> </VirtualHost>
>> <Virtualhost {IP}:8444>
>>    DocumentRoot /www/webapps2
>>    ServerName {hostname}
>>    mod_ssl config2...
>> </VirtualHost>
>> 
>> The second virtual host shall deliver only a subset of webapps1, but
>> configured client cert auth to avoid issues with PHA and renotiation.
>> 
>> Now, I am looking for the same in Tomcat. Given that I have one Server, one
>> Service, two Connectors one Engine and two Hosts there is no way to bind a
>> Host in Tomcat to an listen address, but only to a hostname/IP address.
>>  From my understanding of the server.xml I would need set up *two* Service
>> elements with one Engine, Connector and Host each.
>> 
>> Is my understanding correct?
> 
> Yes. Connector elements are associated with a Service so if you want
> different Hosts on different ports you need different Services.


Thanks, I already thought so. This is a solution I can happily live with.

Maybe this could be simplified in Tomcat 11 from an admin/developer point of
view.

M

Re: Mimicking two distinct virtual hosts just like in HTTPd

Posted by Mark Thomas <ma...@apache.org>.
On 08/11/2021 15:36, Michael Osipov wrote:
> Folks,
> 
> consider the following in httpd.conf:
> 
> Listen {IP}:8443
> Listen {IP}:8444
> 
> later:
> <Virtualhost {IP}:8443>
>    DocumentRoot /www/webapps1
>    ServerName {hostname}
>    mod_ssl config...
> </VirtualHost>
> <Virtualhost {IP}:8444>
>    DocumentRoot /www/webapps2
>    ServerName {hostname}
>    mod_ssl config2...
> </VirtualHost>
> 
> The second virtual host shall deliver only a subset of webapps1, but 
> configured client cert auth to avoid issues with PHA and renotiation.
> 
> Now, I am looking for the same in Tomcat. Given that I have one Server, 
> one Service, two Connectors one Engine and two Hosts there is no way to 
> bind a Host in Tomcat to an listen address, but only to a hostname/IP 
> address.
>  From my understanding of the server.xml I would need set up *two* 
> Service elements with one Engine, Connector and Host each.
> 
> Is my understanding correct?

Yes. Connector elements are associated with a Service so if you want 
different Hosts on different ports you need different Services.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org