I just set jk2 + apache2 + tomcat4 + virtualhosts using unixsockets
*** httpd.conf
<VirtualHost xxx.xxx.xxx.xxx>
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /document/root/htdocs
ServerName virtualhost1.mycompany.com
ErrorLog /document/root/logs/error_log
CustomLog /document/rootlogs/access_log common
ScriptAlias /cgi-bin/ "/document/root/cgi-bin/"
<Location /jsp>
JKUriSet worker ajp13:unixsocket
</Location>
</VirtualHost>
## This allows me to have both cgi's and jsp's for a virtualhost
** workers2.properties
[shm]
file=/path/to/shm.file
size=1048576
# Example unixsocket channel.
[channel.un:unixsocket]
file=/path/to/jk2.socket
# define the worker
[ajp13:unixsocket]
channel=channel.un:unixsocket
[status:status]
# Uri mapping
[uri:/examples/*]
worker=ajp13:unixsocket
[uri:/jsp/*]
worker=ajp13:unixsocket
[uri:/status/*]
worker=status:status
** server.xml
<Host className="org.apache.catalina.core.StandardHost"
appBase="/path/to/jsp" autoDeploy="true"
configClass="org.apache.catalina.startup.ContextConfig"
contextClass="org.apache.catalina.core.StandardContext" debug="0"
deployXML="true"
errorReportValveClass="org.apache.catalina.valves.ErrorReportValve"
liveDeploy="true"
mapperClass="org.apache.catalina.core.StandardHostMapper"
name="virtualhost1.mycompany.com" unpackWARs="false">
<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true"
crossContext="false" debug="0" docBase="/path/to/jsp"
mapperClass="org.apache.catalina.core.StandardContextMapper" path="/jsp"
privileged="false" reloadable="false" swallowOutput="false"
useNaming="true" wrapperClass="org.apache.catalina.core.StandardWrapper">
<Logger className="org.apache.catalina.logger.FileLogger"
debug="0" directory="logs" prefix="virtualhost1_log." suffix=".txt"
timestamp="true" verbosity="1"/>
</Context>
</Host>
My virtual hosting seems to be working. I'm struggling with deploying
oreilly's cos.jar. I've placed the jar files in all possible places but
it seems that tomcat is unable to find it at the time of compilation.
Unjarring the file and placing the class files in
/path/to/jsp/WEB-INF/classes doesn't help either. And log files aren't
exactly that helpful.
On Fri, 20 Sep 2002, Dmitry Letin wrote:
> I finally found the bug (or whatever it is) that caused problems:
>
> in source file jk/native2/server/apache2/mod_jk2.c
> in line 680 (I have revision 1.49) that reads:
>
> uriEnv = workerEnv->uriMap->mapUri(env, workerEnv->uriMap,NULL,r->uri);
>
> "NULL" should be replaced to "r->server->server_hostname" (without the quotes of
>course)
>
> This NULL - was the reason for invalid handling of virtual hosts.
> I have not tested this a lot yet, but virtual hosts are dispached properly now :-)
>:-)
>
> This fix is for apache2 only.
> I actually typed manually the stuff above - could not do copy/paste - hope I made no
>typos
>
> Recompile mod_jk2.so after this change - and all works!!!!
>
> Dmitry
>
>
>
>
>
> Hello all,
> I'm having the same problem, and I've been banging my head against it on and
> off for about a week with no more success than anyone else... Essentially,
> we're all trying to map the root of different virtual hosts to a different
> context within tomcat, right? I started looking elsewhere and found that
> Resin's apache module utilizes the ServerName directive within a
> <VirtualHost> block to select different web apps... If it's a make-or-break
> deal, you might want to look there. Another workaround possibility that I'm
> toying with now is to use mod_rewrite within apache to redirect *.jsp
> requests from http://www.vhost1.com to http://www.vhost1.com/vh1/ and map
> the /vh1/*.jsp uri to the proper context. It just seems virtual host
> support via mod_jk2 is not possible without duct tape and bubble gum, which
> is a shame because the unix socket feature is fantastic...
>
> Ah, for the good old days of JServ/JSSI...
>
>
> ----- Original Message -----
> From: Dmitry Letin <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Sent: Thursday, September 19, 2002 6:46 PM
> Subject: RE: mod_jk2, virtual hosts, JkUriSet
>
>
> > Hi Robert,
> >
> > In my config files I of course use real domains.
> > I did try to use only workers2.properties files for configuration.
> > It seems that virtual host part is ignored, so that these are the same
> when
> > jk2 selects worker:
> >
> >
> >
> > # The virtual host part seems to be ignored anyway
> > # [uri:www.vhost1.com:80/*.jsp] - not working as well
> > [uri:www.vhost1.com/*.jsp]
> > worker=ajp13:localhost:8009
> >
> > # The virtual host part seems to be ignored anyway
> > # [uri:www.vhost2.com:80/*.jsp] - not working as well
> > [uri:www.vhost2.com/*.jsp]
> > worker=ajp13:localhost:8013
> >
> >
> > My problem comes from the fact that the virtual host part in uri seems to
> be ignored
> > when jk2 selects a worker, and only url path is cheched by jk2 code.
> Because that part is the same
> > it is dispached to the same tomcat instance.
> >
> > I do have proper entries in my /etc/hosts file (I'm on Linux) and I did
> try this as well
> >
> > [uri:142.54.3.10:80]
> > alias=www.vhost1.com:80
> >
> > It did not help.
> >
> > I promise to write a how-to on this if I manage to solve this problem :-)
> > But I have doubts I can solve it :-(
> >
> >
> > Dmitry
> >
> >
> >
> >
> > -----Original Message-----
> > From: Robert L Sowders [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, September 19, 2002 6:32 PM
> > To: Tomcat Users List
> > Subject: Re: mod_jk2, virtual hosts, JkUriSet
> >
> > Forgot to mention,
> >
> > Here's a snip from the default workers2.properties file from the src
> >
> > [uri:127.0.0.1:8003]
> > info=Example virtual host. Make sure myVirtualHost is in /etc/hosts to
> > test it
> > alias=myVirtualHost:8003
> >
> > On a windows machine the hosts file is in c:\WinNT\system32\drivers\etc
> > You'll also have to define the connector in the server.xml file.
> >
> >
> >
> >
> >
> >
> > "Robert L Sowders" <[EMAIL PROTECTED]>
> > 09/19/2002 02:48 PM
> > Please respond to "Tomcat Users List"
> >
> >
> > To: "Tomcat Users List" <[EMAIL PROTECTED]>
> > cc:
> > Subject: Re: mod_jk2, virtual hosts, JkUriSet
> >
> > Hmmmm,
> >
> > looks like you got some funny domains for those VirtualHosts as well as
> > some nonstandard JkUriSet statements. You probably have a problem with
> > one or both.
> >
> > Others have been successful.
> > http://www.mail-archive.com/[email protected]/msg66171.html
> >
> > Make your virtual hosts as fully qualified domains and make your JkUriSet
> > commands like the example. Leave the port selection up to the
> > workers2.properties file.
> >
> > Regardless of how you do it, after you are successful a nice step by step
> > How To would be appreciated by all.
> >
> > rls
> >
> >
> >
> >
> >
> > "Dmitry Letin" <[EMAIL PROTECTED]>
> > 09/19/2002 01:24 PM
> > Please respond to "Tomcat Users List"
> >
> >
> > To: <[EMAIL PROTECTED]>
> > cc:
> > Subject: mod_jk2, virtual hosts, JkUriSet
> >
> > Hi,
> >
> > Has anybody managed to successfully connect apache virtual hosts to
> > different
> > instances of tomcat using mod_jk2?
> >
> > I spent several days looking at all available documentation, mail archives
> >
> > and
> > a bit of source code but could not make a working solution.
> >
> > I have no problem connecting to a single TomcatInstance. Problems start
> > when
> > I need to connect to two separate instances.
> >
> > I did check docs in
> http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/index.html
> > and found them not helpful.
> >
> >
> > For simplicity:
> > I need to connect /*.jsp from apache VirtualHost1 to TomcatInstance1
> > and /*.jsp from apache VirtualHost2 to TomcatInstance2
> >
> > I would greatly appreciate if somebody could send required fragments from
> > a WORKING config files: httpd.conf, workers2.conf and jk2.properties.
> >
> >
> > >From jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk2.c I
> > found:
> >
> > * Example:
> > * <VirtualHost foo.com>
> > * <Location /examples>
> > * JkUriSet worker ajp13
> > * </Location>
> > * </VirtualHost>
> > *
> > * This is the best way to define a webapplication in apache. It is
> > * scalable ( using apache native optimizations, you can have hundreds
> > * of hosts and thousands of webapplications ), 'natural' to any
> > * apache user.
> >
> > Does it work properly at all?
> >
> > In my case I have:
> >
> > <VirtualHost vh1>
> > <Location /*.jsp>
> > JkUriSet worker ajp13:localhost:8009
> > </Location>
> > </VirtualHost>
> >
> > <VirtualHost vh2>
> > <Location /*.jsp>
> > JkUriSet worker ajp13:localhost:8013
> > </Location>
> > </VirtualHost>
> >
> > But in the end all requests (even from vh1) are routed to worker
> > ajp13:localhost:8013
> > But I expected them to be routed to ajp13:localhost:8009
> >
> > Looks like a bug to me.
> >
> >
> > Thanks,
> > Dmitry Letin
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>