Configuring Apache HTTP Server 2.0/2.2 as proxy server for backend Tomcat/tc Server instance with multiple virtual hosts (2010334)
search cancel

Configuring Apache HTTP Server 2.0/2.2 as proxy server for backend Tomcat/tc Server instance with multiple virtual hosts (2010334)

book

Article ID: 293368

calendar_today

Updated On:

Products

VMware Tanzu tc Server

Issue/Introduction

Tomcat/tc Server is configured for multiple name-based virtual hosts, each serving its own set of web applications. This article provides information on configuring an Apache proxy server to forward requests to a backend Tomcat/tc Server instance so that each set of web applications is served by its respective virtual host only.

Environment


Resolution

This example shows how to configure an Apache proxy server to forward requests to a single back-end Tomcat/tc Server instance with multiple name-based virtual hosts. In this example, mod_proxy is used to forward the requests.
    NameVirtualHost *:80

    <VirtualHost *:80>
        DocumentRoot /www/ns_vhost1
        ServerName www.ns_vhost1.com
        ErrorLog logs/ns_vhost1_error.log
        TransferLog logs/ns_vhost1_access.log
        ProxyPass / http://ns_tomcat_vhost1:8080/
        ProxyPassReverse / http://ns_tomcat_vhost1:8080/
    </VirtualHost>

    <VirtualHost *:80>
        DocumentRoot /www/ns_vhost2
        ServerName www.ns_vhost2.com
        ErrorLog logs/ns_vhost2_error.log
        TransferLog logs/ns_vhost2_access.log
        ProxyPass / http://ns_tomcat_vhost2:8080/
        ProxyPassReverse / http://ns_tomcat_vhost2:8080/
    </VirtualHost>

    <VirtualHost *:80>
        DocumentRoot /www/ns_vhost3
        ServerName www.ns_vhost3.com
        ErrorLog logs/ns_vhost3_error.log
        TransferLog logs/ns_vhost3_access.log
        ProxyPass / http://ns_tomcat_vhost3:8080/
        ProxyPassReverse / http://ns_tomcat_vhost3:8080/
    </VirtualHost>

In order for the Apache index document to be remapped to the ROOT context on the Tomcat/tc Server side, there should be a ROOT web application context for each Tomcat/tc Server virtual host.

Additional Information