You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jonathan Mast <jh...@gmail.com> on 2008/12/02 17:19:14 UTC
Can I specify virtual hosts in JKMounts?
I'm using Apache+Tomcat (1.3.33, 5.5.17) and I have servlet named "bar",
with no file extension in its name.
bar is in a folder named "foo" which is reachable by 2 virtual hosts:
www.mysite.com/foo/bar
foo.mysite.com/bar
I know to how tell apache that request for /bar on the WWW virtual host
should be handled by Tomcat:
JkMount /foo/* ajp13
Simple enough, but can I also specify foo.mysite.com as well, like this?
JkMount foo.mysite.com/* ajp13
I searched around and it none of the documentation seems to explicitly say
whether or not virtual hosts can be used in JkMount directives.
Thanks
Re: Can I specify virtual hosts in JKMounts?
Posted by Rainer Jung <ra...@kippdata.de>.
Jonathan Mast schrieb:
> Thanks for the response, I didn't know JkMount directives could be placed
> within VirtualHost declarations.
Older versions of mod_jk tolerated putting JkMount in the global server,
not any vhost. All those mounts were automatically copied to all vhosts.
Since a couple of releases you actually have to put your JkMounts into
the VHosts, or use the JkMountCopy (On|All) construction. See JkMount
and JkMountCopy in
http://tomcat.apache.org/connectors-doc/reference/apache.html
I suggest you make sure to use a recent version (most recent is 1.2.27)
and put your JkMount into the individual VHosts.
> Our httpd.conf uses the following:
>
> <IfModule mod_jk.c>
> JkWorkersFile /usr/local/tomcat/conf/workers.properties
> JkLogFile logs/jk.log
> JkLogLevel error
> JkMount /*.jsp ajp13
> JkMount /servlet/* ajp13
> </IfModule>
>
> This is located beneath all our VirtualHost declarations, I presume it must
> be declared before the virtualhost stuff, in order for the JkMount directive
> to be recognized, correct?
I think putting it above is not necessary, but you should in general
- put the JkMount inside the VHosts, or if appropriate use JkMountCopy
- decide whether you want a separate log file per VHost (then add a
JkLogFile with a separate filoe name to each vhost) or only one common
consolidated log file
- consider using rotatelogs for your JkLogFile. It works syntactically
the same way you use it with Apache ErrorLog.
> And won't all the VirtualHost decls have to be within the <IfModule ...>
> tags?
The IfModule tags do not add any functionality except when the module is
not loaded (no LoadModule for mod_jk executed), apache ignore all parts
contained inside the IfModule. It allows you to switch faster between a
configuration using mod_jk and not using it. If you always want to use
it for this Apache, it adds a little unsafety, because if you forget to
load mod_jk, you won't get any error. Without the IfModule Apache will
complain, that it does not know about the Jk directives.
Regards,
Rainer
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Can I specify virtual hosts in JKMounts?
Posted by Jonathan Mast <jh...@gmail.com>.
Thanks for the response, I didn't know JkMount directives could be placed
within VirtualHost declarations. Our httpd.conf uses the following:
<IfModule mod_jk.c>
JkWorkersFile /usr/local/tomcat/conf/workers.properties
JkLogFile logs/jk.log
JkLogLevel error
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
</IfModule>
This is located beneath all our VirtualHost declarations, I presume it must
be declared before the virtualhost stuff, in order for the JkMount directive
to be recognized, correct?
And won't all the VirtualHost decls have to be within the <IfModule ...>
tags?
Thanks
On Tue, Dec 2, 2008 at 11:45 AM, André Warnier <aw...@ice-sa.com> wrote:
> Jonathan Mast wrote:
>
>> I'm using Apache+Tomcat (1.3.33, 5.5.17) and I have servlet named "bar",
>> with no file extension in its name.
>>
>> bar is in a folder named "foo" which is reachable by 2 virtual hosts:
>> www.mysite.com/foo/bar
>> foo.mysite.com/bar
>>
>> I know to how tell apache that request for /bar on the WWW virtual host
>> should be handled by Tomcat:
>> JkMount /foo/* ajp13
>>
>> Simple enough, but can I also specify foo.mysite.com as well, like this?
>> JkMount foo.mysite.com/* ajp13
>>
>> (Note that above, you are not just re-directing "bar" to Tomcat, you are
> redirecting much more)
>
>
> I'm guessing a number of things here, but you seem to talk about
> VirtualHosts in Apache, apparently something like this :
>
> <VirtualHost *:80>
> ServerName www.mysite.com
> ...
> </VirtualHost>
>
> <VirtualHost *:80>
> ServerName foo.mysite.com
> ...
> </VirtualHost>
>
> So why not then
>
> <VirtualHost *:80>
> ServerName www.mysite.com
> JkMount /foo/bar ajp13
> JkMount /foo/bar* ajp13
> </VirtualHost>
>
> <VirtualHost *:80>
> ServerName foo.mysite.com
> JkMount /bar ajp13
> JkMount /bar* ajp13
> </VirtualHost>
>
> If it makes it easier, and at least in Apache 2.x, you can also use
> sections like
>
> <Location /foo/bar>
> SetHandler jakarta-servlet
> ...
> </Location>
>
> as a kind of alias for your JkMount directives.
> This is a bit harder to find in the documentation, but it appears here :
> http://tomcat.apache.org/connectors-doc/reference/apache.html
> Using SetHandler and Environment Variables
> (at the very end)
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Can I specify virtual hosts in JKMounts?
Posted by André Warnier <aw...@ice-sa.com>.
Jonathan Mast wrote:
> I'm using Apache+Tomcat (1.3.33, 5.5.17) and I have servlet named "bar",
> with no file extension in its name.
>
> bar is in a folder named "foo" which is reachable by 2 virtual hosts:
> www.mysite.com/foo/bar
> foo.mysite.com/bar
>
> I know to how tell apache that request for /bar on the WWW virtual host
> should be handled by Tomcat:
> JkMount /foo/* ajp13
>
> Simple enough, but can I also specify foo.mysite.com as well, like this?
> JkMount foo.mysite.com/* ajp13
>
(Note that above, you are not just re-directing "bar" to Tomcat, you are
redirecting much more)
I'm guessing a number of things here, but you seem to talk about
VirtualHosts in Apache, apparently something like this :
<VirtualHost *:80>
ServerName www.mysite.com
...
</VirtualHost>
<VirtualHost *:80>
ServerName foo.mysite.com
...
</VirtualHost>
So why not then
<VirtualHost *:80>
ServerName www.mysite.com
JkMount /foo/bar ajp13
JkMount /foo/bar* ajp13
</VirtualHost>
<VirtualHost *:80>
ServerName foo.mysite.com
JkMount /bar ajp13
JkMount /bar* ajp13
</VirtualHost>
If it makes it easier, and at least in Apache 2.x, you can also use
sections like
<Location /foo/bar>
SetHandler jakarta-servlet
...
</Location>
as a kind of alias for your JkMount directives.
This is a bit harder to find in the documentation, but it appears here :
http://tomcat.apache.org/connectors-doc/reference/apache.html
Using SetHandler and Environment Variables
(at the very end)
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org