Hey folks. I think I am going to write something up on this because I have a fairly complex situation that covers what you need to do to get virtual hosts working and since documentation is non-existent. I figured it out by experimenting and I now have a completely operational systems. I don't have the complete config where I am now so I will just describe and then send a pointer out when the write up is done.
My general setup is as follows: I am using JDK 1.4 with Tomcat 4.0.3, Apache 1.3.22 (with WARP so). I have 4 virtual hosts, some of them require (additionally) to be used via SSL and non-SSL (so it is basically 8 name/port combinations). Also, I wanted some of them to be in different Java/Tomcat VM's since I don't want one going down to take out others. Generally speaking this is what I do: In my httpd.conf, at the top, I list all of my connections since I share some of the connections between different hosts (essentially you can and should share a connection when you don't care if the VM goes down between the two and if they are both either SSL or both not SSL covered). Also, make sure you tell Apache you are doing name virtual hosts (if they don't have different IP's). Then in the virtual hosts I put the WebAppDeploy. BUT since I am using JSP's right off the bat and since I only want to manage the contents of a virtual host in one place, the WebAppDeploy looks like this (even when the connection is shared): WebApp Deploy . connectiion Yes it looks like they would then be sharing the exact same applications...but that isn't true, I manage the virtual hosts in the server.xml, which imo, is what you want to do (again manage from one place). So let's switch to the server.xml's. Since I run more than Tomcat instance I have a set of scripts that startup the different instances, making sure to set $CATALINA_HOME (mainly for the bin directory), and $CATALINA_BASE (for the specific server instance). In the server.xml (I will recall just one), I have one Server tag, and then I have 2 Service takes. The difference Service areas are to make sure that I properly cover SSL and non-SSL connections. So in each of the Service areas I tell it scheme="http" (or "https") and secure="false" (or "true") as is necessary. BUT this doesn't actually turn on SSL, remember that SSL handling is covered by Apache. This is so that when a JSP or Servlet asks if the connection is secure, the answer will be yes. So then in the Engine area you place your virtual hosts. This is through the Host tag, making sure you specify name="virtual host name". I then have a Context in that which directs to the appropriate root location (in the same directory on the server I have different sub-directories for the http and https based roots). Anyway, this should be enough pointers, without many examples, to get you going. Basically the sample server.xml in Tomcat has what you are looking for BUT it implies that you don't do it with WARP because it is all under the HTTP connector. But much of that you can actually use with WARP, and it works well. When I write it up I will include example scripts/conf/xml files and some of the interesting things I found. I think it will be a useful resource for the community in generally (it can be frustrating, but I generally had fun figuring it out). ---------------------------------------- Joseph Molnar http://www.codesta.com/ ----- Original Message ----- From: "Nikola Milutinovic" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Saturday, April 06, 2002 5:04 AM Subject: Re: Warp and Virtual Hosts (quick question) > Charlie Toohey wrote: > > > When configuring Apache's httpd.conf (or Vhosts.conf) with multiple > > name-based virtual hosts, I can not find any documentation regarding the > > WebAppConnection statement. Should I have a separate WebAppConnection within > > each virtual host section, or should I just have one WebAppConnection in the > > main section of httpd.conf, and then refer to that in each of the > > WebAppDeploy statements that are within the virtual host sections (I do > > understand that the WebAppDeploy statements for each given webapp needs to > > be within the virtual host section --- it is the WebAppConnection which I'm > > not sure about). > > Never done this myself, since I'm still not in "production" environment, but... > > There was an excellent article on java.sun.com on thi subject and basically it > boils to this - docs on Tomcat side are lacking. In your server.xml, "warp" > connector should reflect the VirtualHosts of your Apache setup. In the comments > it says: > > <!-- Replace "localhost" with what your Apache "ServerName" is set to --> > > They meant "Apache" instead of "localhost". > > From that I'd conclude that each VirtualHost should have: > > - one DNS entry > - one apache <VirtualHost ...> > - one Tomcat <Engine ...>...</Engine> > - one (at least) Warp connection between the two > > For larger virtual hostings you might want to consider running several Tomcat > instances for, either each one or groups of virtual hosts. > > Nix. > > > -- > To unsubscribe: <mailto:[EMAIL PROTECTED]> > For additional commands: <mailto:[EMAIL PROTECTED]> > Troubles with the list: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>
