简体   繁体   中英

running multiple tomcat instances on Apache

I'm running Apache HTTPD on port 80, and I have 2 instances of Apache Tomcat on port 8080 and 1010. I deployed a war file on each tomcat:

project1.war on tomcat1
project2.war on tomcat2

The goal is being able to call project1 and project2 using just the domain, I want to avoid using the port number in the URL.

I figured out that mod_jk is the right tool to use for this purpose but I couldn't configure Apache properly to run it. I have two domains ready to use:

domain1.mysite.com 
domain2.mysite.com

Any help is appreciated. Thank you

You'd be needing some apache httpd virtual host configuration like

Listen 80
<VirtualHost *:80>

   ServerName domain1.mysite.com 
   ProxyPass "/project1" "ajp://backend.example.com:8009/project1"
   ProxyPassReverse "/project1" "http://www.example.com/project1"
   # Other directives here
 </VirtualHost>

<VirtualHost *:80>

    ServerName domain2.mysite.com 
    ProxyPass "/project2" "ajp://backend.example.com:8009/project2"
    ProxyPassReverse "/project2" "http://www.example.com/project2"

    # Other directives here
</VirtualHost>    

composed from Httpd VirtualHost Configuration and mod_proxy_ajp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM