1

I am trying to host www.test.com/test1 and www.test.com/test2 on the same apache server (port 80 and 443) where test1 is deployed on first tomcat(port 8009) and test2 is deployed on second tomcat(port 8010). one apache instance and two tomcat instances running on the same linux machine and i have only one IP available to host both the application. Kindly help with httpd.conf and server.xml configurations. Tomcat1 appBase is /opt/webapps and tomcat2 appbase /opt/webapps1. My current configurations are like below.

Httpd.conf:

    ServerName    test.domain.com
    JkMount /test1 node1
    JkMount /test2 node2
    DocumentRoot "/opt/"
    Alias /test1 /opt/webapps/test1
    Alias /test2 /opt/webapps1/test2
    ProxyRequests On
    ProxyVia      On
    ProxyPreserveHost On
    ProxyPass /test1/ http://xx.xx.xx.xx:8009/test1
    ProxyPassReverse /test1/  http://xx.xx.xx.xx:8009/test1
    ProxyPass /test2/ http://xx.xx.xx.xx:8010/test2
    ProxyPassReverse /test2/  http://xx.xx.xx.xx:8010/test2
    RedirectMatch ^/$ https://test.domain.com/test1/
    Include /opt/apache-tomcat.base/conf/mod_jk-test1.conf
    Include /opt/apache-tomcat.base2/conf/mod_jk-test2t.conf

Worker.properties:

workers.java_home=/usr/lib/jvm/jre
workers.node1.tomcat_home=/opt/apache-tomcat
workers.node2.tomcat_home=/opt/apache-tomcat2
worker.list=node1,node2,jkstatus
worker.node1.port=8009
worker.node1.host=localhost
worker.node1.type=ajp13
worker.node1.max_packet_size=65536
worker.node2.port=8010
worker.node2.host=localhost
worker.node2.type=ajp13
worker.node2.max_packet_size=65536
worker.jkstatus.type=status

Server.xml for tomcat1

    <Connector port="8009" address="localhost" protocol="AJP/1.3">

Server.xml for tomcat2

<Connector port="8010" address="localhost" protocol="AJP/1.3">

Mod_jk-test1.conf:

Alias /test1 "/opt/webapps/test1/"
<Location "/ test1/">
    Options -Indexes FollowSymLinks
    DirectoryIndex Main.html
    Order allow,deny
    Allow from all
</Location>
Alias /test2 "/opt/webapps1/ test2 /"
<Location "/ test2 /">
    Options -Indexes FollowSymLinks
    DirectoryIndex Main.html
    Order allow,deny
    Allow from all
</Location>
JkMount / test1 node1
JkMount / test2 node2
Mugdha Roy
  • 11
  • 2
  • Show us your current config files. What symptoms do you observe when using them? – J_H Nov 11 '19 at 15:22
  • 1
    See: https://stackoverflow.com/questions/13550121/apache-tomcat-proxypass-and-proxypassreverse – Pavlus Nov 11 '19 at 15:29
  • Possible duplicate of [Apache & Tomcat: ProxyPass and ProxyPassReverse](https://stackoverflow.com/questions/13550121/apache-tomcat-proxypass-and-proxypassreverse) – Pavlus Nov 11 '19 at 15:29

0 Answers0