Bill, I believe I know what you are trying to do. I have done the a smiliar thing. Let me answer your questions one at a time.
> I need to set up a few virtual hosts for a > development project, and > being new to Tomcat virtual hosts, have a couple of > questions: By virtual hosts, I assume you mean multiple domains all hosted on the same box, like www.firstsite.com, www.secondsite.com, etc with all different pages being displayed at each site, with one tomcat server running. To do this, you have to get your server.xml configuration just right, as well as have your hosts files setup (or DNS entries). Right now, on my server, I have four virtual hosts. I have 4 different DNS entries all pointing to the same IP. The configuration in server.xml makes tomcat point each address to a different directory with my web content for each site. > 1. In development, the clients and tomcat will be on > an intranet. I plan > to use the hosts files of the client and tomcat > boxes to map domain > names to IP addresses, thereby preempting invocation > of DNS, and thus > exposure of our product-specific domain names to the > Internet at-large, > until the site is deployed publicly. > Therefore, without DNS entries, you must put an entry for each desired virtual host into the hosts file on each client you wish to have pointing to the server, with the ip address. > Question 1: Is this hosts-file approach feasible? Yes. Quite feasible. > Does tomcat care HOW > domain names > are mapped to IP addresses? Not that I know of. But I am no expert. > The following fragment is extracted from > conf/server.xml of the the > tomcat distribution: > > <Host name="localhost" debug="0" appBase="webapps" > unpackWARs="true" autoDeploy="true" > xmlValidation="false" > xmlNamespaceAware="false"> > <Logger > className="org.apache.catalina.logger.FileLogger" > directory="logs" > prefix="localhost_log." suffix=".txt" > timestamp="true"/> > </Host> > To get each virtual host to direct to its own page, you must have one whole host entry for each virtual host where localhost is replaced by the domain that you desire (e.g. www.firstdomain.com). Then, within the host entry, create a context to point to the proper directory structure. > Question 2: Why is the host named localhost? Just a convention of UNIX machines. You pick any other name you want for mapping to ip's that you put in your hosts file or a DNS entry (assuming it is registered to you). > I > expected that only URL's of the form > http://localhost:8080/... would be > handled by this virtual host, but it seems to handle > any URL's that map > to the IP and port of the real host that tomcat > serves. By default (i believe) any name that does not have a corresponding Host entry in the server.xml file is routed to the first entry (or something like that) so your virtual hosts won't split to different pages until you create a host entry for each one. > ------------------- > Question 3: How would one configure a 'local' > virtual host, i.e. a host > visible only on the box that runs tomcat? > ------------------- Just put the entry for the desired domain in the hosts file of only the local machine (the server) and not in the hosts files on the other machines on the network. It's that easy. If I can give any other pointers, just ask another question. Good luck, Justin Jaynes __________________________________ Do you Yahoo!? The all-new My Yahoo! - Get yours free! http://my.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
