tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brandon Cruz" <>
Subject RE: virtual hosting with tomcat and apache
Date Fri, 06 Apr 2001 20:27:57 GMT
Does anyone have any experience with several virtual hosts, all running
tomcat in one virtual machine?  This seems to be the best solution for us to
keep within our server's limits.  We have many sites and that many JVM's
would take all our resources.  Any help would be greatly appreciated.  What
does your tomcat-apache.conf look like, what does your server.xml look like,
do you use mod_jserv, and do you just include the tomcat-apache.conf in your
httpd.conf file?  Thanks!

Brandon Cruz

-----Original Message-----
From: Jeff Kilbride []
Sent: Thursday, April 05, 2001 9:46 PM
Subject: Re: virtual hosting with tomcat and apache

Hi Brandon,

I'm doing a lot of virtual hosting with Apache + Tomcat, but in my case only
one of my Vhosts needs Tomcat. So, I'm setting mine up with the "one JVM for
all hosts" config. It's actually pretty simple.

Use the <Host> directive in your server.xml file:

<Host name="your.vhost.domain" >
    <Context path=""

In either your httpd.conf or mod_jk.conf, add your Vhost:
(can be name-based or ip-based)

<VirtualHost 111.222.333.444>
        ServerName your.vhost.domain
        ServerAdmin your_admin@domain
        DocumentRoot "/path/to/your/normal/html"

        JkMount /servlet/* ajp13
        JkMount /*.jsp ajp13

        Alias /alias_dir "/path/to/your/docBase"
        <Directory "/path/to/your/docBase">
                allow from all

        <Location "/alias_dir/WEB-INF">
                AllowOverride None
                deny from all

        <Location "/alias_dir/META-INF">
                AllowOverride None
                deny from all


This simple config works for me. You can add several Vhosts this way, as
long as you don't mind running them in the same JVM. Check out the mod_jk
Howto. That's where I got most of this info.


----- Original Message -----
From: "Scott Tatum" <>
To: <>
Sent: Thursday, April 05, 2001 4:00 PM
Subject: Re: virtual hosting with tomcat and apache

> Your first message went through. Tomcat can do exactly what you need. It
can be
> configured to run several vhosts, each as their own application. Normally
> give each vhost its own Tomcat instance, to provide a clean separation of
> runtime enviroments between sites. It also gives you the ability to
restart one
> Tomcat instance without having to bring them all down (at least, with
ajp12). I
> believe that you can also run them all under one Tomcat instance. I have
> this before with Tomcat standalone, I assume it also works connected to
> but I recommend going the separate VM route if you are running vhosts.
> I recommend the latest version of Apache (currently 1.3.19) and Tomcat
3.2.1. I
> think 3.2.2 will be out in the next couple of weeks, it would be a good
> as well. You should use mod_jk, and not mod_jserv. I recommend getting
both the
> binary and source versions of 3.2.1. Use the binary version for Tomcat
> and use the source version just for compiling mod_jk. Configuring
> Apache+Tomcat+mod_jk+vhosts is not a trivial task for sure, and there's
not a
> concise resource for setting it all up. The documentation that comes with
> Tomcat has a lot of information, but the pieces you need are spread across
> several documents. Be sure to read the mod_jk howto, as well as the
> howto.
> As far as configuration goes, don't use the automatically generated config
> files - they aren't going to have what you want for vhosts. Just create
> from scratch. With the aforementioned setup, the important config files
> server.xml,,, and mod_jk.conf.
A few
> other files (web.xml, web.dtd, tomcat-users.xml, tomcat.policy) are also
> important, just not usually for initial setup. When you find the section
in the
> documentation that talks about creating a separate server.xml file for
> vhost, you are looking in the right place. In order to do separate VM's
that is
> the route you need to go. Also, watch out for the dreaded CPU loop, which
> easy to do with virtual hosts. See the 3.2.1 release notes, section 6.11
> that. I've had some interesting experiences with that issue in the past
> of days, and I'm going to make a separate post to the group with some
> I haven't seen posted yet.
> Tomcat is well suited for what you want to do, but I can assure you it's
> to take a couple of hours minimum figuring out how to configure it the way
> want it. So grab your favorite drink and have a seat. If you encounter any
> snags along the way (which you will) mail to the group or to me
> preferably to the group. I will respond either way. :) (now that I have
> up on my 1500 message backlog, ugh) Good luck!
> -Scott
> --
> Scott Tatum |
> Senior Applications Developer, Special Projects
> WorldCom |
> Brandon Cruz wrote:
> > I sent a message a while ago, but don't think it went though.
Basically, I
> > am using Tomcat as a servlet/jsp engine for a site that uses Apache as
> > webserver.  Only problem is that I am on one server with several virtual
> > host directories.  I want to be able to put .jsp files into each vhost
> > directory.  Has anyone done anything like this with either tomcat or
> > other product that can plug into apache and serve jsp's and servlets?
> > help or tips would be greatly appreciated!!!
> >
> > Thanks!
> >
> > Brandon

View raw message