Reputation: 57958
What are the normal ways of hosting multiple web apps on a single tomcat?
One way i can think of doing it is using different context paths for the different applications, but that makes the url look ugly for potential customers.
edit: i need to host different applications on a single tomcat
Upvotes: 4
Views: 2581
Reputation: 4094
There are a lot of ways.
And of course you should front your tomcat with an apache server. Best way would be imho to use mod_proxy_ajp.
For multiple instances you can have a look here: http://wiki.v-collaborate.com/display/BLOG/2010/12/08/Install+Apache+Tomcat+7+on+ubuntu+and+debian?showComments=true
For the third way there is another post on my blog: http://wiki.v-collaborate.com/display/BLOG/2010/12/16/Configure+a+virtual+host+in+Apache+Tomcat+7 A good source is also: http://confluence.atlassian.com/display/DOC/Guide+to+using+Apache+Tomcat%27s+Virtual+Hosts
Upvotes: 3
Reputation: 532
The "standard" approach to this solution is to front your tomcat instance with an http server that can proxy either: 1. AJP - A binary protocol tighter (therefore faster) than http. 2. Http
So your virtual sites in apache respond to bob.com and proxies to localhost:8080/bob and alice.com to localhost:8080/alice.
Look for mod_proxy mod_proxy_ajp docs and you should be set.
Upvotes: 2
Reputation: 80186
What do you mean by url looking ugly? Anyways there are 2 deployment models: single-tenant (diff context paths but simple) and multi-tenant (single context path but complex (though achievable))
You might also be interested to look my answer here: Developing a Multitenant SaaS
Upvotes: 1