> -----Original Message-----
> From: Paul van Hoven [mailto:[email protected]]
> Sent: Tuesday, November 27, 2012 2:13 PM
> To: Tomcat Users List
> Subject: Re: Tomcat with multiple domains
> 
> Thanks for the answer. I followed the tutorial you propose (
> http://wiki.apache.org/tomcat/TomcatDevelopmentVirtualHosts ). But it
> is still not working. Here is my new configuration
> 
> 
> server.xml
> <Host name="2nddomain.com"
> appBase="/opt/apache-tomcat-7.0.32/2nddomain.com" unpackWARs="true"
> autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
>               <Alias>2nddomain.com</Alias>
>               <Alias>www.2nddomain.com</Alias>
>       </Host>
> 
> The directory
> /opt/apache-tomcat-7.0.32/2nddomain.com
> contains a ROOT.war file.
> 
> I edited the /etc/hosts file and added the following entries:
> 88.84.140.88  www.2nddomain.com:8080
> 88.84.140.88  www.1rstdomain.com:8080
> 
> Then I restarted the system and the tomcat server. Entering
> www.2nddomain.com:8080 sends me to 1rstdomain.com. I noticed that the
> file  "/opt/apache-tomcat-7.0.32/2nddomain.com/ROOT.war" remains
> untouched by tomcat, at least nothing is extracted from the war file.
> 
> So what else am I missing here?

Make sure that the new <Host></Host> definition is nested inside the 
<Engine></Engine> tags.
You also do not need the first <Alias> line.  The name= parameter takes care of 
that mapping for you.
In general, the nesting works this way:
<Server ... >
  <Service ... >
    <Connector ... />
    <Connector ... />
    <Engine ... >
      <Host name="host1.com" ... >
        <Alias>www.host1.com</Alias>
      </Host>
      <Host name="www.host2.com" ... >
        <Alias>host2.com</Alias>
      </Host>
      <Host name="www.myhost.com" ... />
    </Engine>
  </Service>
</Server>

There are a myriad other tag sets that could be included in there and it's very 
important that they be nested properly to work properly.

Also, since you are using the /etc/hosts file instead of the DNS system, the 
client (browser) also has those entries in its hosts file.  And, as Konstantin 
pointed out, you don't put the port number in the /etc/hosts file.
If you are using DNS for the clients, make sure that it has entries for both 
hosts, pointing to the same IP address.  


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to