Hi Bogus, Am Donnerstag, 12. Mai 2005 00:52 schrieb Bagus: > Here's a more general question about Tomcat. > > I'm used to using apache to set up virtual hosts, but when Tomcat > installed, http://localhost/ now goes to my tomcat installation. So > how does one set up multiple virtual hosts with Tomcat? Is it in the > server.xml file or something? Or do I somehow now modify my apache > configuration to be able to use tomcat and the jsp files?
have a look here: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/engine.html http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/host.html http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html You need to know a bit about all three to successfully set up a virtual host. (1) ENGINE As regards the Engine element, the only important thing is the defaultHost parameter: "The default host name, which identifies the Host that will process requests directed to host names on this server, but which are not configured in this configuration file. This name MUST match the name attributes of one of the Host elements nested immediately inside." "You can nest one or more Host elements inside this Engine element, each representing a different virtual host associated with this server. At least one Host is required, and one of the nested Hosts MUST have a name that matches the name specified for the defaultHost attribute, listed above." So, if you should later change the hostname of the default host, that means the name attribute of the Host element representing the default host, you must not forget to set the defaultHost attribute of the Engine element accordingly. (2) HOST Different to the Apache HTTP server, a virtual host is not equivalent with a web application in Tomcat terms. It can host several web applications, and so the Host element only contains the appBase attribute and not a docBase attribute: "appBase: The Application Base directory for this virtual host. This is the pathname of a directory that may contain web applications to be deployed on this virtual host." (3) CONTEXT Concerning the Context element, you have to observe three things: a) "You may define as many Context elements as you wish. Each such Context MUST have a unique context path, which is defined by the path attribute. In addition, you MUST define a Context with a context path equal to a zero-length string. This Context becomes the default web application for this virtual host, and is used to process all requests that do not match any other Context's context path." b) Normally, your context files will be placed here: $CATALINA_HOME/conf/[enginename]/[hostname]/ So, if you should later change the hostname, that means the name attribute of the Host element, you must not forget to rename the directory of the associated context files accordingly. c) For the web application which you want to run as ROOT application - http://localhost:8080/ instead of http://localhost:8080/webapp/ - need to have a context file called ROOT.xml: $CATALINA_HOME/conf/[enginename]/[hostname]/ROOT.xml Best wishes Lutz --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]