Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a server system on which i want to host java web application's. I can do that only with tomcat and can host multiple application's, but i don't know how can i host multiple application's on root of tomcat, so that i can access those application's with their domain names like, and so on. Something like virtual shared hosting.

I have used Ngasi and liked the features that allow me to host multiple apps. on root context. Unfortunately Ngasi is not free, so i am looking for a free alternative to Ngasi that can manage the virtual shared hosting.

share|improve this question

2 Answers 2

Hosting several applications in one Tomcat is always problematic. You can't easily restart just one application without affecting all the others.

What works for me is an apache2 / httpd web server as the front end (can also handle many domain names, ssl, rewrite etc.) which then forwards everything to several Tomcat instances, either running on the same server or even on different servers. Just use different port numbers.

Here's an example entry:

<VirtualHost *:80>

  <Directory /home/web0000/www>
    Options FollowSymLinks
    Order allow,deny
    Allow from all

  DocumentRoot /home/web0000/www

  ProxyPass        /robots.txt !
  ProxyPass        /path1       http://localhost:9002/path1       
  ProxyPassReverse /path1       http://localhost:9002/path1       
  ProxyPass        /anotherpath http://localhost:9012/anotherpath 
  ProxyPassReverse /anotherpath http://localhost:9012/anotherpath 
  ProxyPass        /path3       http://localhost:9022/path3       
  ProxyPassReverse /path3       http://localhost:9022/path3       

  ServerAdmin info@mydomain.tld
  ServerName example.mydomain.tld

share|improve this answer

It is easy to host multiple domains/apps at Jelastic. Here is detailed instructions and

share|improve this answer
Please don't just answer with a link, give some summary so in a year's time (when the link if gone for good) the answer still has some use. – vonbrand Apr 3 '13 at 20:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.