You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Danny Trunk <dt...@gmail.com> on 2015/10/10 17:57:58 UTC

Multiple Hosts with same appBase

Hello everyone,

I need to access the appBase itself as default and access the appBase
with a specific docBase by a different host/domain.
I'm currently running Tomcat 7.0.26 on Linux Ubuntu 12.04.5.

Here are the essential bits of my server.xml:

<Engine name="Catalina" defaultHost="localhost">
  <Host name="localhost"  appBase="webapps" unpackWARs="true"
autoDeploy="false" />
  <Host name="example.com" appBase="webapps" unpackWARs="true"
autoDeploy="false" deployOnStartup="false">
    <Alias>www.example.com</Alias>
    <Context docBase="mywebapp" path="" />
  </Host>
</Engine>

Currently all domains are returning the "mywebapp" webapp.
What's wrong and how to resolve?

Best regards
Danny.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Multiple Hosts with same appBase

Posted by Danny Trunk <dt...@gmail.com>.

Am 10.10.2015 um 19:16 schrieb Mark Thomas:
> On 10/10/2015 17:29, Danny Trunk wrote:
>> Am 10.10.2015 um 18:05 schrieb Mark Thomas:
>>> On 10/10/2015 16:57, Danny Trunk wrote:
>>>> Hello everyone,
>>>>
>>>> I need to access the appBase itself as default and access the appBase
>>>> with a specific docBase by a different host/domain.
>>>> I'm currently running Tomcat 7.0.26 on Linux Ubuntu 12.04.5.
>>>>
>>>> Here are the essential bits of my server.xml:
>>>>
>>>> <Engine name="Catalina" defaultHost="localhost">
>>>>   <Host name="localhost"  appBase="webapps" unpackWARs="true"
>>>> autoDeploy="false" />
>>>>   <Host name="example.com" appBase="webapps" unpackWARs="true"
>>>> autoDeploy="false" deployOnStartup="false">
>>>>     <Alias>www.example.com</Alias>
>>>>     <Context docBase="mywebapp" path="" />
>>>>   </Host>
>>>> </Engine>
>>>>
>>>> Currently all domains are returning the "mywebapp" webapp.
>>>> What's wrong and how to resolve?
>>> Set deployOnStartup to false and you should get the behaviour you want.
>>>
>>> That said:
>>>
>>> 1. Overlapping appBase's are generally a bad idea. The only safe way to
>>> make it work is to disable all automatic deployment and deploy all
>>> Context's explicitly in server.xml.
>>>
>>> 2. Not following the standard naming convention is generally a bad idea.
>>> The only safe way to make it work is to disable all automatic deployment
>>> and deploy all Context's explicitly in server.xml.
>>>
>>>
>>> Mark
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>> Now I'm getting a blank page with response code 404 for default host.
>> example.com is still working correctly.
> "... and deploy all Context's explicitly in server.xml."
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Thanks. That solved my problem.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Multiple Hosts with same appBase

Posted by Mark Thomas <ma...@apache.org>.
On 10/10/2015 17:29, Danny Trunk wrote:
> 
> Am 10.10.2015 um 18:05 schrieb Mark Thomas:
>> On 10/10/2015 16:57, Danny Trunk wrote:
>>> Hello everyone,
>>>
>>> I need to access the appBase itself as default and access the appBase
>>> with a specific docBase by a different host/domain.
>>> I'm currently running Tomcat 7.0.26 on Linux Ubuntu 12.04.5.
>>>
>>> Here are the essential bits of my server.xml:
>>>
>>> <Engine name="Catalina" defaultHost="localhost">
>>>   <Host name="localhost"  appBase="webapps" unpackWARs="true"
>>> autoDeploy="false" />
>>>   <Host name="example.com" appBase="webapps" unpackWARs="true"
>>> autoDeploy="false" deployOnStartup="false">
>>>     <Alias>www.example.com</Alias>
>>>     <Context docBase="mywebapp" path="" />
>>>   </Host>
>>> </Engine>
>>>
>>> Currently all domains are returning the "mywebapp" webapp.
>>> What's wrong and how to resolve?
>> Set deployOnStartup to false and you should get the behaviour you want.
>>
>> That said:
>>
>> 1. Overlapping appBase's are generally a bad idea. The only safe way to
>> make it work is to disable all automatic deployment and deploy all
>> Context's explicitly in server.xml.
>>
>> 2. Not following the standard naming convention is generally a bad idea.
>> The only safe way to make it work is to disable all automatic deployment
>> and deploy all Context's explicitly in server.xml.
>>
>>
>> Mark
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
> Now I'm getting a blank page with response code 404 for default host.
> example.com is still working correctly.

"... and deploy all Context's explicitly in server.xml."

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Multiple Hosts with same appBase

Posted by Danny Trunk <dt...@gmail.com>.
Am 10.10.2015 um 18:05 schrieb Mark Thomas:
> On 10/10/2015 16:57, Danny Trunk wrote:
>> Hello everyone,
>>
>> I need to access the appBase itself as default and access the appBase
>> with a specific docBase by a different host/domain.
>> I'm currently running Tomcat 7.0.26 on Linux Ubuntu 12.04.5.
>>
>> Here are the essential bits of my server.xml:
>>
>> <Engine name="Catalina" defaultHost="localhost">
>>   <Host name="localhost"  appBase="webapps" unpackWARs="true"
>> autoDeploy="false" />
>>   <Host name="example.com" appBase="webapps" unpackWARs="true"
>> autoDeploy="false" deployOnStartup="false">
>>     <Alias>www.example.com</Alias>
>>     <Context docBase="mywebapp" path="" />
>>   </Host>
>> </Engine>
>>
>> Currently all domains are returning the "mywebapp" webapp.
>> What's wrong and how to resolve?
> Set deployOnStartup to false and you should get the behaviour you want.
>
> That said:
>
> 1. Overlapping appBase's are generally a bad idea. The only safe way to
> make it work is to disable all automatic deployment and deploy all
> Context's explicitly in server.xml.
>
> 2. Not following the standard naming convention is generally a bad idea.
> The only safe way to make it work is to disable all automatic deployment
> and deploy all Context's explicitly in server.xml.
>
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
Now I'm getting a blank page with response code 404 for default host.
example.com is still working correctly.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Multiple Hosts with same appBase

Posted by Mark Thomas <ma...@apache.org>.
On 10/10/2015 16:57, Danny Trunk wrote:
> Hello everyone,
> 
> I need to access the appBase itself as default and access the appBase
> with a specific docBase by a different host/domain.
> I'm currently running Tomcat 7.0.26 on Linux Ubuntu 12.04.5.
> 
> Here are the essential bits of my server.xml:
> 
> <Engine name="Catalina" defaultHost="localhost">
>   <Host name="localhost"  appBase="webapps" unpackWARs="true"
> autoDeploy="false" />
>   <Host name="example.com" appBase="webapps" unpackWARs="true"
> autoDeploy="false" deployOnStartup="false">
>     <Alias>www.example.com</Alias>
>     <Context docBase="mywebapp" path="" />
>   </Host>
> </Engine>
> 
> Currently all domains are returning the "mywebapp" webapp.
> What's wrong and how to resolve?

Set deployOnStartup to false and you should get the behaviour you want.

That said:

1. Overlapping appBase's are generally a bad idea. The only safe way to
make it work is to disable all automatic deployment and deploy all
Context's explicitly in server.xml.

2. Not following the standard naming convention is generally a bad idea.
The only safe way to make it work is to disable all automatic deployment
and deploy all Context's explicitly in server.xml.


Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org