You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sampath K Settipalli <Sa...@genome.wi.mit.edu> on 2001/09/21 18:39:57 UTC

setting virtualhost (portbased) apache-mod_jk-tomcat

Hi All,

        My requirement is I need to setup different virtual hosts for
each user in my development environment. Each user will be having
his/her own copy of classes in a different directory/path which each
ones context in tomcat points to. I went throught the documents and
user-archive mails and tried to setup port -based virtual hosts . For
the same IP address of apache use one port per each user. I'm not really
sure if port-based VH is a good option or go for IP-based VH .
This is what I did.

httpd.conf::::::
-------------------
I added directive
Listen 5180
Listen 5181 (1 virtual host of a user)
Listen 5182 (for 2nd user)

Then
<VirtualHost XX.XXX.X.XXX:5181>
 ServerName www.squid.sampath.edu
 DocumentRoot /usr/home/squid/sandbox/sampath/squid
 JkMount /servlet/* ajp13
 JkMount /*.jsp ajp13
 # URL aliases
 Alias /squid/login
"/usr/home/squid/sandbox/sampath/squid/common/html/login.html"
 Alias /squid/login.html
"/usr/home/squid/sandbox/sampath/squid/common/html/login.html"
</VirtualHost>
----------
For 2nd user
<VirtualHost XX.XXX.X.XXX:5182>
 ServerName www.squid.user2.edu
 DocumentRoot /usr/home/squid/sandbox/user2/squid
 JkMount /servlet/* ajp13
 JkMount /*.jsp ajp13
 # URL aliases for pages that need easy to type in URL's
 Alias /squid/login
"/usr/home/squid/sandbox/user2/squid/common/html/login.html"
 Alias /squid/login.html
"/usr/home/squid/sandbox/user2/squid/common/html/login.html"
</VirtualHost>
-------------------------------------
IP address XX.XXX.X.XXX is same for all users

Changes in server.xml::::
--------------
<Host name="www.squid.sampath.edu" >
           <Context path=""
                    docBase="webapps/ROOT/sqdev-sampath" >
      crossContext="false"
      debug=9
      reloadable="true">
    </Context>
 </Host>

 <Host name="www.squid.user2.edu" >
           <Context path=""
                    docBase="webapps/ROOT/sqdev-tedd" >
      crossContext="false"
      debug=9
      reloadable="true">
    </Context>
  </Host>
-------------------------------
No changes to workers.properties. Do I need to do any ?

With this when I try apache starts fine and  when I type virtuahost name
www.squid.sampath.edu its not recognised. Howver when I type IPaddress
XX.XXX.X.XXX:5181/5182 it recognizes the aliases and displays the html
page but then looks like it doesn't forward the request to tomcat
(executes a servlet) or not recognised from here. It says "The server
encountered an internal error or misconfiguration and was unable to
complete your request." .
It used to work fine without virtual hosts.
-----------
Now as per my requirement is Port based  virtualHosts a good way to
set-up or will IP-based Virtual hosts be a good way.
When coming to JVM should all Virtual hosts be under 1 JVM or each under
1 JVM.
Can someone please suggest and point me in the right direction.
I'm using apache 1.3.20, mod_jk and tomcat 3.2.3 on solaris.

Thanks in advance,
Sampath