Take the 2-minute tour ×
Server Fault is a question and answer site for professional 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 example.com,example2.com 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
add comment

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
  </Directory>

  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

</VirtualHost>
share|improve this answer
add comment

It is easy to host multiple domains/apps at Jelastic. Here is detailed instructions http://jelastic.com/docs/multiple-domains and http://jelastic.com/docs/multiple-domains2.

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
add comment

Your Answer

 
discard

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.