You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by tomcatnip <ha...@gmail.com> on 2009/10/11 12:56:34 UTC

VirtualHost configuration working in Tomcat 5.5 does not work in Tomcat 6.0.20

Hi.

I have a fairly popular website which runs on a Apache Tomcat 5.5. I just
upgraded to 6.0.20 and copied the Virtual Host configuration from my older
server (i.e. Tomcat 5.5) to the new one.

I cannot access my site with the VirtualHost's domain name. I get a 404 not
found.

I have two Virtual Hosts (i.e. <Host ...>) , one called www.mydomain.net
(with WWW) and mydomain.net (without WWW). The latter (mydomain.net) simply
points to a directory which contains an index.jsp page with a 301 redirect
to the www.mydomain.net domain. This is for SEO purposes.

I get a 404 not found when I try to access my site this way (using a
browser):

1. mydomain.net
2. www.mydomain.net
3. www.mydomain.net/<directory containing site>
4. <ip address>

Points 1 and 4 in the list above are simply 301 redirects to
www.mydomain.net, so a 404 is not surprising. It seems the www makes it not
work.

I can access it by going to:

1. mydomain.net/<directory containing site>
2. <ip address>/<directory containing site>

I can also access another dummy wepage with:

www.mydomain.net/<path to dummy webpage> (with the www)

I know this seems inconsistent. But that is the reason for this post.

Note this works perfectly in Tomcat 5.5.

Here is the configuration: 

<Engine name="Catalina" defaultHost="mydomain.net">

<Host name="www.mydomain.net" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="<path_to_website>"/>

</Host>
<Host name="mydomain.net" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="<path_to_301_redirect>"

      </Host>

I would be grateful for any help on this topic.

Thanks.
-- 
View this message in context: http://www.nabble.com/VirtualHost-configuration-working-in-Tomcat-5.5-does-not-work-in-Tomcat-6.0.20-tp25842386p25842386.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: VirtualHost configuration working in Tomcat 5.5 does not workin Tomcat 6.0.20

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Pid [mailto:pid@pidster.com]
> Subject: Re: VirtualHost configuration working in Tomcat 5.5 does not
> workin Tomcat 6.0.20
> 
> <Host name="mydomain.net" appBase="/path/to/website/appBase"
>         unpackWARs="true" autoDeploy="true"
>         xmlValidation="false" xmlNamespaceAware="false">
>        </Host>
> 
> <Host name="mydomain.net" appBase="/path/to/redirect/appBase"
>         unpackWARs="true" autoDeploy="true"
>         xmlValidation="false" xmlNamespaceAware="false">
>        </Host>
> 
> You don't need the Context definition if that is all you had configured
> on it.

Actually, if that's all there is for the virtual hosting, the OP doesn't need it at all.  Simply remove the second <Host> (the one not pointed to by the <Engine> defaultHost attribute); all requests will end up at the same place anyway.

In general, it's a bad idea to just copy configuration elements from one level of Tomcat to another.  Better to understand what they do in the older version, read the doc for the new one, and generate the necessary config as appropriate.  Some subtleties can easily catch you out otherwise.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


Re: VirtualHost configuration working in Tomcat 5.5 does not work in Tomcat 6.0.20

Posted by tomcatnip <ha...@gmail.com>.
Hi,

that worked perfectly. Thanks very much!



Pid Ster wrote:
> 
> On 11/10/2009 11:56, tomcatnip wrote:
>>
>> Hi.
>>
>> I have a fairly popular website which runs on a Apache Tomcat 5.5. I just
>> upgraded to 6.0.20 and copied the Virtual Host configuration from my
>> older
>> server (i.e. Tomcat 5.5) to the new one.
>>
>> I cannot access my site with the VirtualHost's domain name. I get a 404
>> not
>> found.
>>
>> I have two Virtual Hosts (i.e.<Host ...>) , one called www.mydomain.net
>> (with WWW) and mydomain.net (without WWW). The latter (mydomain.net)
>> simply
>> points to a directory which contains an index.jsp page with a 301
>> redirect
>> to the www.mydomain.net domain. This is for SEO purposes.
>>
>> I get a 404 not found when I try to access my site this way (using a
>> browser):
>>
>> 1. mydomain.net
>> 2. www.mydomain.net
>> 3. www.mydomain.net/<directory containing site>
>> 4.<ip address>
>>
>> Points 1 and 4 in the list above are simply 301 redirects to
>> www.mydomain.net, so a 404 is not surprising. It seems the www makes it
>> not
>> work.
>>
>> I can access it by going to:
>>
>> 1. mydomain.net/<directory containing site>
>> 2.<ip address>/<directory containing site>
>>
>> I can also access another dummy wepage with:
>>
>> www.mydomain.net/<path to dummy webpage>  (with the www)
>>
>> I know this seems inconsistent. But that is the reason for this post.
>>
>> Note this works perfectly in Tomcat 5.5.
>>
>> Here is the configuration:
>>
>> <Engine name="Catalina" defaultHost="mydomain.net">
>>
>> <Host name="www.mydomain.net" appBase="webapps"
>>         unpackWARs="true" autoDeploy="true"
>>         xmlValidation="false" xmlNamespaceAware="false">
>> <Context path="" docBase="<path_to_website>"/>
>>
>> </Host>
>> <Host name="mydomain.net" appBase="webapps"
>>         unpackWARs="true" autoDeploy="true"
>>         xmlValidation="false" xmlNamespaceAware="false">
>> <Context path="" docBase="<path_to_301_redirect>"
>>
>>        </Host>
> 
> Place your files in the ROOT directory.
> 
> /path/to/website/appBase
> /path/to/website/appBase/ROOT
> 
> /path/to/redirect/appBase
> /path/to/redirect/appBase/ROOT
> 
> 
> <Host name="mydomain.net" appBase="/path/to/website/appBase"
>         unpackWARs="true" autoDeploy="true"
>         xmlValidation="false" xmlNamespaceAware="false">
>        </Host>
> 
> <Host name="mydomain.net" appBase="/path/to/redirect/appBase"
>         unpackWARs="true" autoDeploy="true"
>         xmlValidation="false" xmlNamespaceAware="false">
>        </Host>
> 
> You don't need the Context definition if that is all you had configured 
> on it.
> 
> p
> 
> 
> 
> 
> 
>> I would be grateful for any help on this topic.
>>
>> Thanks.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/VirtualHost-configuration-working-in-Tomcat-5.5-does-not-work-in-Tomcat-6.0.20-tp25842386p25843293.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: VirtualHost configuration working in Tomcat 5.5 does not work in Tomcat 6.0.20

Posted by Pid <pi...@pidster.com>.
On 11/10/2009 11:56, tomcatnip wrote:
>
> Hi.
>
> I have a fairly popular website which runs on a Apache Tomcat 5.5. I just
> upgraded to 6.0.20 and copied the Virtual Host configuration from my older
> server (i.e. Tomcat 5.5) to the new one.
>
> I cannot access my site with the VirtualHost's domain name. I get a 404 not
> found.
>
> I have two Virtual Hosts (i.e.<Host ...>) , one called www.mydomain.net
> (with WWW) and mydomain.net (without WWW). The latter (mydomain.net) simply
> points to a directory which contains an index.jsp page with a 301 redirect
> to the www.mydomain.net domain. This is for SEO purposes.
>
> I get a 404 not found when I try to access my site this way (using a
> browser):
>
> 1. mydomain.net
> 2. www.mydomain.net
> 3. www.mydomain.net/<directory containing site>
> 4.<ip address>
>
> Points 1 and 4 in the list above are simply 301 redirects to
> www.mydomain.net, so a 404 is not surprising. It seems the www makes it not
> work.
>
> I can access it by going to:
>
> 1. mydomain.net/<directory containing site>
> 2.<ip address>/<directory containing site>
>
> I can also access another dummy wepage with:
>
> www.mydomain.net/<path to dummy webpage>  (with the www)
>
> I know this seems inconsistent. But that is the reason for this post.
>
> Note this works perfectly in Tomcat 5.5.
>
> Here is the configuration:
>
> <Engine name="Catalina" defaultHost="mydomain.net">
>
> <Host name="www.mydomain.net" appBase="webapps"
>         unpackWARs="true" autoDeploy="true"
>         xmlValidation="false" xmlNamespaceAware="false">
> <Context path="" docBase="<path_to_website>"/>
>
> </Host>
> <Host name="mydomain.net" appBase="webapps"
>         unpackWARs="true" autoDeploy="true"
>         xmlValidation="false" xmlNamespaceAware="false">
> <Context path="" docBase="<path_to_301_redirect>"
>
>        </Host>

Place your files in the ROOT directory.

/path/to/website/appBase
/path/to/website/appBase/ROOT

/path/to/redirect/appBase
/path/to/redirect/appBase/ROOT


<Host name="mydomain.net" appBase="/path/to/website/appBase"
        unpackWARs="true" autoDeploy="true"
        xmlValidation="false" xmlNamespaceAware="false">
       </Host>

<Host name="mydomain.net" appBase="/path/to/redirect/appBase"
        unpackWARs="true" autoDeploy="true"
        xmlValidation="false" xmlNamespaceAware="false">
       </Host>

You don't need the Context definition if that is all you had configured 
on it.

p





> I would be grateful for any help on this topic.
>
> Thanks.


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