You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Scott Ahten <pi...@pixelfreak.net> on 2003/04/08 00:27:48 UTC
Strategy for Hosting Multiple Sites with Apache / Tomcat
I've managed to get Tomcat running with Apache using Mod JK2 thanks to
the great reference found here...
http://www.gregoire.org/howto/Apache2_Jk2_TC4.1.x_JSDK1.4.x.html
[ thanks to Robert Sowders! ]
My ultimate goal is to host multiple sites on a single instance of
Tomcat 4.1x and Apache2 using virtual hosting. Most of these sites have
been running in Tomcat stand-alone, but I would like to front these
sites with Apache to provide better performance on static content and
SSL support.
Since I have Tomcat and Apache 2 talking, I am now faced with strategic
questions which are of a less technical nature.
01. Separation of Dynamic and Static Content
Currently, all content for each domain lives in a single webapp and
host with it's own document root. This is very convenient since we only
have to update a single directory tree when changes are made to a site.
Based on my observations, I will need to separate dynamic and static
content and store them in two different document roots - one for a
Tomcat context/webapp and another for Apache static content. This seems
very awkward and error prone. Is there a better way to do this?
02. Webapps or Contexts in Tomcat
What is the most common way to separate dynamic content in Tomcat?
Should I create a single host with a separate context for each domain
or should I use multiple webapps instead?
Also, I've noticed that when I make changes to the workers2.properties
file, I have to reboot - otherwise, tomcat fails to start since it
can't bind to port 8080. Strange....
Thanks in advance,
~Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: John Turner, Yoav Shapira
Posted by Micael <ca...@harbornet.com>.
I certainly double this sentiment. These two people provide excellent
advice that is well-honed and without rancor. They are really appreciated.
At 10:52 AM 4/8/03 -0500, Jim Henderson wrote:
>John Turner and Yoav Shapira has been of great help to this community. I
>know there are others and by no means am I trying to lessen their
>contribution, but John and Yoav have been of personal help and therefore
>stick out in my mind.
>
>Thanks you two and all the others! We are grateful. I wish I had your
>talents.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
LEGAL NOTICE
This electronic mail transmission and any accompanying documents contain
information belonging to the sender which may be confidential and legally
privileged. This information is intended only for the use of the
individual or entity to whom this electronic mail transmission was sent as
indicated above. If you are not the intended recipient, any disclosure,
copying, distribution, or action taken in reliance on the contents of the
information contained in this transmission is strictly prohibited. If you
have received this transmission in error, please delete the message. Thank
you
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: John Turner, Yoav Shapira
Posted by Paul Yunusov <py...@rogers.com>.
On Tuesday 08 April 2003 11:52 am, Jim Henderson wrote:
> John Turner and Yoav Shapira has been of great help to this community. I
> know there are others and by no means am I trying to lessen their
> contribution, but John and Yoav have been of personal help and therefore
> stick out in my mind.
>
> Thanks you two and all the others! We are grateful. I wish I had your
> talents.
>
I second that. Kudos!
Paul
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: John Turner, Yoav Shapira
Posted by John Turner <to...@johnturner.com>.
Thanks for the kind words, but not necessary. I've benefitted from open
source software quite a bit over the years, and want to do my small part to
"pay it forward", so to speak.
I've learned quite a bit myself from others on this list over the last 10
months or so. I am embarrassed to say that if you were to check back in
the archives, you would see me ranting about all the stuff that others rant
about (the current state of the documentation, bugs, etc.). I finally took
the suggestions of the gurus to heart and decided that the best thing for
me to do was to shut up and put up to the extent my limited dev abilities
would allow. LOL I wouldn't know what I know now about Tomcat and Apache
if it weren't for this list, and people like Bill Barker, Tim Funk, Craig
McClanahan, Yoav Shapira, Milt Epstein, Mladen Turk, and a whole bunch of
others that I can't even remember.
If you saw the contents of my "Tomcat Save" folder in my email client,
you'd get an idea of all the good stuff posted by others that I have filed
away for investigation later, to try and come up to speed on a whole slew
of subjects. Too much to list. Catching up will be a daunting task, that's
for sure.
I haven't seen him post about it in awhile, but don't forget about the
Tomcat FAQ managed by Tim Funk at http://tomcatfaq.sourceforge.net.
There's good stuff there, and plenty more coming. I know anyone with
additions to the FAQ is welcome to contribute.
John
On Tue, 8 Apr 2003 10:52:24 -0500, Jim Henderson <jg...@metafile.com> wrote:
>
> John Turner and Yoav Shapira has been of great help to this community. I
> know there are others and by no means am I trying to lessen their
> contribution, but John and Yoav have been of personal help and therefore
> stick out in my mind.
>
> Thanks you two and all the others! We are grateful. I wish I had your
> talents.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: John Turner, Yoav Shapira
Posted by Jan Behrens <ja...@diekleinedomain.de>.
Howdy :)
still being quite new to this list and Tomcat, I definitely learned loads just
by reading what these two contribute.
Thanks for that!
Jan
> -----Original Message-----
> From: Jim Henderson [mailto:jgh@metafile.com]
> Sent: Tuesday, April 08, 2003 5:52 PM
> To: Tomcat Users List
> Subject: John Turner, Yoav Shapira
>
>
>
> John Turner and Yoav Shapira has been of great help to this community. I
> know there are others and by no means am I trying to lessen their
> contribution, but John and Yoav have been of personal help and therefore
> stick out in my mind.
>
> Thanks you two and all the others! We are grateful. I wish I had your
> talents.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
RE: John Turner, Yoav Shapira
Posted by Jeremy Whitlock <jw...@starprecision.com>.
I second that.
-----Original Message-----
From: Jim Henderson [mailto:jgh@metafile.com]
Sent: Tuesday, April 08, 2003 9:52 AM
To: Tomcat Users List
Subject: John Turner, Yoav Shapira
John Turner and Yoav Shapira has been of great help to this community.
I
know there are others and by no means am I trying to lessen their
contribution, but John and Yoav have been of personal help and therefore
stick out in my mind.
Thanks you two and all the others! We are grateful. I wish I had your
talents.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
John Turner, Yoav Shapira
Posted by Jim Henderson <jg...@metafile.com>.
John Turner and Yoav Shapira has been of great help to this community. I
know there are others and by no means am I trying to lessen their
contribution, but John and Yoav have been of personal help and therefore
stick out in my mind.
Thanks you two and all the others! We are grateful. I wish I had your
talents.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Strategy for Hosting Multiple Sites with Apache / Tomcat
Posted by John Turner <to...@johnturner.com>.
On Tue, 8 Apr 2003 11:30:23 -0400, Scott Ahten <pi...@pixelfreak.net>
wrote:
> a. Wouldn't Apache2 and Tomcat sharing the same document root cause a
> security issue with the WEB-INF folder? I guess I could try to block
> access to this folder on the Apache side using some type of directive in
> the HTTPD.conf or ht access file.
That's correct. You can block access like this in httpd.conf:
<Location "/myWebApp/WEB-INF/*">
AllowOverride None
deny from all
</Location>
<Location "/myWebApp/META-INF/*">
AllowOverride None
deny from all
</Location>
>
> b. Not all of our content resides in the document root. It is nested in
> multiple folders based on the logical structure of the site. Example...
>
> /index.html
> /images/logo.gif
> /contact/index.html
> /contact/images/contact_header.gif
> /contact/handle_contact.jsp
> /contact/ack.jsp
> /contact/nak.jsp
> ...
>
> Do we need separate mount [or URI commands in our case with JK2] for each
> subdirectory or is there a way to define a single URI pattern that sends
> all JSP requests to Tomcat no matter where it exists in the directory
> structure?
Something like "/*.jsp" will take care of any JSP. The "*" is a wildcard,
and applies to any number of nested directories.
In the case of something like "/contact/images/contact_header.gif", this
would be handled by Apache, whether "/contact" was a Tomcat webapp or not,
provided your JK/JK2 URL maps are correct. As long as Apache could find
it, your users would not see a broken image link.
>>> 02. Webapps or Contexts in Tomcat
>>>
>>> What is the most common way to separate dynamic content in Tomcat?
>>> Should I create a single host with a separate context for each domain
>>> or should I use multiple webapps instead?
>>
>> I use a separate Host for each virtual host.
>
> c. The documentation on Mod JK2 isn't clear on how to specify a
> particular Tomcat Host when forwarding requests from Apache.
I don't use JK2, but I would guess it's pretty similar to JK from a logical
viewpoint, even though the syntax of the URL map is different.
> Thanks for your help,
>
> ~Scott
John
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Strategy for Hosting Multiple Sites with Apache / Tomcat
Posted by Scott Ahten <pi...@pixelfreak.net>.
John,
Thanks for you input on this issue. This leads me to additional
questions listed bellow...
On Tuesday, April 8, 2003, at 08:45 AM, John Turner wrote:
> On Mon, 7 Apr 2003 18:27:48 -0400, Scott Ahten <pi...@pixelfreak.net>
> wrote:
>
>> 01. Separation of Dynamic and Static Content
>>
>> Currently, all content for each domain lives in a single webapp and
>> host with it's own document root. This is very convenient since we
>> only have to update a single directory tree when changes are made to
>> a site. Based on my observations, I will need to separate dynamic and
>> static content and store them in two different document roots - one
>> for a Tomcat context/webapp and another for Apache static content.
>> This seems very awkward and error prone. Is there a better way to do
>> this?
>
> There is no requirement to do this. Apache's document root can easily
> be Tomcat's webapp root. It doesn't matter where the file is coming
> from, in this scenario you are just trying to set Apache as the server
> for static content. Where Apache finds that content is irrelevant. We
> typically push our dynamic content into sub directories lilke /jsp and
> /servlet. In a virtual hosting environment, that may not be desired
> for cosmetic reasons. In any case, Apache's document root can be
> virtually anywhere (as can Tomcat's, as long as you configure appBase
> and docBase correctly). I've seen some configurations where admins map
> "/static" as the location of static content.
>
> Using JK, two JkMounts will take care of this for you:
>
> JkMount /*.jsp ajp13
> JkMount /servlet/* ajp13
>
> JSP and servlet requests now go to Tomcat, Apache will server any
> other request. Where Apache finds the file to satisfy the request is
> up to the admin. It could be the same place where the JSP are stored,
> or somewhere else.
>
a. Wouldn't Apache2 and Tomcat sharing the same document root cause a
security issue with the WEB-INF folder? I guess I could try to block
access to this folder on the Apache side using some type of directive
in the HTTPD.conf or ht access file.
b. Not all of our content resides in the document root. It is nested in
multiple folders based on the logical structure of the site. Example...
/index.html
/images/logo.gif
/contact/index.html
/contact/images/contact_header.gif
/contact/handle_contact.jsp
/contact/ack.jsp
/contact/nak.jsp
...
Do we need separate mount [or URI commands in our case with JK2] for
each subdirectory or is there a way to define a single URI pattern that
sends all JSP requests to Tomcat no matter where it exists in the
directory structure?
> John
>
>> 02. Webapps or Contexts in Tomcat
>>
>> What is the most common way to separate dynamic content in Tomcat?
>> Should I create a single host with a separate context for each domain
>> or should I use multiple webapps instead?
>
> I use a separate Host for each virtual host.
c. The documentation on Mod JK2 isn't clear on how to specify a
particular Tomcat Host when forwarding requests from Apache.
I'll post a separate message on clarifying how this is done to the list.
Thanks for your help,
~Scott
>
>>
>> ~Scott
>
> John
>
> --
> Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Strategy for Hosting Multiple Sites with Apache / Tomcat
Posted by John Turner <to...@johnturner.com>.
On Mon, 7 Apr 2003 18:27:48 -0400, Scott Ahten <pi...@pixelfreak.net>
wrote:
> 01. Separation of Dynamic and Static Content
>
> Currently, all content for each domain lives in a single webapp and host
> with it's own document root. This is very convenient since we only have
> to update a single directory tree when changes are made to a site. Based
> on my observations, I will need to separate dynamic and static content
> and store them in two different document roots - one for a Tomcat
> context/webapp and another for Apache static content. This seems very
> awkward and error prone. Is there a better way to do this?
There is no requirement to do this. Apache's document root can easily be
Tomcat's webapp root. It doesn't matter where the file is coming from, in
this scenario you are just trying to set Apache as the server for static
content. Where Apache finds that content is irrelevant. We typically push
our dynamic content into sub directories lilke /jsp and /servlet. In a
virtual hosting environment, that may not be desired for cosmetic reasons.
In any case, Apache's document root can be virtually anywhere (as can
Tomcat's, as long as you configure appBase and docBase correctly). I've
seen some configurations where admins map "/static" as the location of
static content.
Using JK, two JkMounts will take care of this for you:
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JSP and servlet requests now go to Tomcat, Apache will server any other
request. Where Apache finds the file to satisfy the request is up to the
admin. It could be the same place where the JSP are stored, or somewhere
else.
John
> 02. Webapps or Contexts in Tomcat
>
> What is the most common way to separate dynamic content in Tomcat? Should
> I create a single host with a separate context for each domain or should
> I use multiple webapps instead?
I use a separate Host for each virtual host.
>
> ~Scott
John
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org