开发者

methods of hosting multiple apps on a single Tomcat

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 th开发者_JS百科at makes the url look ugly for potential customers.

edit: i need to host different applications on a single tomcat


There are a lot of ways.

  1. Just deploy them on a single instance.
  2. Install multiple instances of Tomcat on a single server (e.g. needed for some applications which need separated JVMs)
  3. create virtual hosts in tomcat and deploy every application as ROOT in an own virtual host

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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜