You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jonathan Mast <jh...@gmail.com> on 2008/02/28 18:28:10 UTC

Virtual-Host issues on Apache-Tomcat

I'm trying to a subdomain to our site but Tomcat is not finding the index
page correctly.

Here are my entries into httpd.conf and server.xml:

<VirtualHost *>
    ServerName foo.site.com
    DocumentRoot /usr/local/apache/htdocs/foo
        CustomLog /usr/local/apache/logs/foo.site.com_access_log combined
        ErrorLog /usr/local/apache/logs/redirect.log

</VirtualHost>



     <Host name="foo.site.com"
        unpackWARs="true" autoDeploy="false" >
           <Context path="" docBase="/usr/local/apache/htdocs/foo" />

     </Host>


When I type http://foo.site.com/ I get a 404 - /index.jsp  error.

Must I specify the exact page, ie. index.jsp in the configuration urls or
what?


thanks

Re: Virtual-Host issues on Apache-Tomcat

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jonathan,

Jonathan Mast wrote:
| It is a Tomcat 404 error.

Okay, good. That means that Tomcat is handling the request (rather than
Apache handling it) so we are probably not talking about fixing httpd
configuration or your connector (mod_whatever).

| So I take it that I can specify a file name (index.jsp) in the
configuration
| and it will  default to that file?

Yes, you can. You do it using the <welcome-file-list> element (and
sub-elements) in web.xml. The default <welcome-file-list> is (at least
in TC 5.5):

~    <welcome-file-list>
~        <welcome-file>index.html</welcome-file>
~        <welcome-file>index.htm</welcome-file>
~        <welcome-file>index.jsp</welcome-file>
~    </welcome-file-list>

...where order is relevant (the top file will be used first if it
exists, and so on).

You only have to customize this if you want it to use some other file
(or URI, really) when you specify http://host/ (with no additional path).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkfIhmYACgkQ9CaO5/Lv0PApMQCfaxinrhV4e2shvbF45qTb6xZ5
iJwAn0i71zoyEC44ulKpkr8MKXJ3KBEF
=MY3q
-----END PGP SIGNATURE-----

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


Re: Virtual-Host issues on Apache-Tomcat

Posted by Jonathan Mast <jh...@gmail.com>.
Thanks for the notes.

It is a Tomcat 404 error.

So I take it that I can specify a file name (index.jsp) in the configuration
and it will  default to that file?

On Fri, Feb 29, 2008 at 10:57 AM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Jonathan,
>
> Jonathan Mast wrote:
> | However it is usually linked, I'm obviously not an expert on this
> subject.
> | Perhaps you know a concise summary of how Tomcat and Apahce HTTPD work?
>
> Apache can be linked to Tomcat using either HTTP or AJP protocols. You
> have some options for each:
>
> HTTP: mod_proxy_http, provided by Apache httpd since many versions ago
> AJP: mod_proxy_ajp, included in Apache httpd since 2.2.x
> ~     mod_jk, a separate package that has existed for a long time
> ~     mod_jk2, a separate package that has been abandoned
>
> (I've included that last one since it looks like you have a relatively
> old setup... Apache 1.3, etc.)
>
> All options are equally well supported (except mod_jk2), and each has
> their champions and complainants.
>
> You should be able to find out which modules have been enabled and which
> are configured to do something with your application.
>
> If you see "ProxyPass" keywords near your app configuration in
> httpd.conf (or one of its friends), you're using mod_proxy_http (since
> mod_proxy_ajp wasn't available until a later version of Apache httpd
> than the one you are running).
>
> Instead, if you see "Jk[Something]", then you are more likely running
> mod_jk (or the ghastly mod_jk2).
>
> A few notes:
> * Your JDK version is quite old relative to your Tomcat version.
> ~  If you don't have the "compatibility package" installed, you'll have
> ~  problems. Consider upgrading to Java 1.5 or 1.6.
>
> * I didn't see anywhere in your configuration where you mentioned
> ~  index.jsp, so I'm guessing that Tomcat's <welcome-file> setting is
> ~  being used. Can you tell us if you are getting the 404 from Apache
> ~  httpd or Tomcat?
>
> - -chris
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.8 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEUEARECAAYFAkfIK3UACgkQ9CaO5/Lv0PDb6QCglxwruPhm4Urouty/gstcz8l4
> scoAlR9dPoOyRwvnm8DmxXYoMa6AchI=
> =iNNg
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Virtual-Host issues on Apache-Tomcat

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jonathan,

Jonathan Mast wrote:
| However it is usually linked, I'm obviously not an expert on this subject.
| Perhaps you know a concise summary of how Tomcat and Apahce HTTPD work?

Apache can be linked to Tomcat using either HTTP or AJP protocols. You
have some options for each:

HTTP: mod_proxy_http, provided by Apache httpd since many versions ago
AJP: mod_proxy_ajp, included in Apache httpd since 2.2.x
~     mod_jk, a separate package that has existed for a long time
~     mod_jk2, a separate package that has been abandoned

(I've included that last one since it looks like you have a relatively
old setup... Apache 1.3, etc.)

All options are equally well supported (except mod_jk2), and each has
their champions and complainants.

You should be able to find out which modules have been enabled and which
are configured to do something with your application.

If you see "ProxyPass" keywords near your app configuration in
httpd.conf (or one of its friends), you're using mod_proxy_http (since
mod_proxy_ajp wasn't available until a later version of Apache httpd
than the one you are running).

Instead, if you see "Jk[Something]", then you are more likely running
mod_jk (or the ghastly mod_jk2).

A few notes:
* Your JDK version is quite old relative to your Tomcat version.
~  If you don't have the "compatibility package" installed, you'll have
~  problems. Consider upgrading to Java 1.5 or 1.6.

* I didn't see anywhere in your configuration where you mentioned
~  index.jsp, so I'm guessing that Tomcat's <welcome-file> setting is
~  being used. Can you tell us if you are getting the 404 from Apache
~  httpd or Tomcat?

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEUEARECAAYFAkfIK3UACgkQ9CaO5/Lv0PDb6QCglxwruPhm4Urouty/gstcz8l4
scoAlR9dPoOyRwvnm8DmxXYoMa6AchI=
=iNNg
-----END PGP SIGNATURE-----

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


Re: Virtual-Host issues on Apache-Tomcat

Posted by Jonathan Mast <jh...@gmail.com>.
However it is usually linked, I'm obviously not an expert on this subject.
Perhaps you know a concise summary of how Tomcat and Apahce HTTPD work?

thanks

On Thu, Feb 28, 2008 at 1:51 PM, Mark Thomas <ma...@apache.org> wrote:

> Jonathan Mast wrote:
> > sorry
> >
> > Tomcat 5.5.1
> > Apache 1.3.33
> > Java 1.4.2
>
> And you are linking httpd and Tomcat how?
>
> Mark
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Virtual-Host issues on Apache-Tomcat

Posted by Mark Thomas <ma...@apache.org>.
Jonathan Mast wrote:
> sorry
> 
> Tomcat 5.5.1
> Apache 1.3.33
> Java 1.4.2

And you are linking httpd and Tomcat how?

Mark


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


Re: Virtual-Host issues on Apache-Tomcat

Posted by Jonathan Mast <jh...@gmail.com>.
sorry

Tomcat 5.5.1
Apache 1.3.33
Java 1.4.2


On Thu, Feb 28, 2008 at 1:19 PM, Mark Thomas <ma...@apache.org> wrote:

> Jonathan Mast wrote:
> > I'm trying to a subdomain to our site but Tomcat is not finding the
> index
> > page correctly.
> >
> > Here are my entries into httpd.conf and server.xml:
> >
> > <VirtualHost *>
> >     ServerName foo.site.com
> >     DocumentRoot /usr/local/apache/htdocs/foo
> >         CustomLog /usr/local/apache/logs/foo.site.com_access_log
> combined
> >         ErrorLog /usr/local/apache/logs/redirect.log
> >
> > </VirtualHost>
> >
> >
> >
> >      <Host name="foo.site.com"
> >         unpackWARs="true" autoDeploy="false" >
> >            <Context path="" docBase="/usr/local/apache/htdocs/foo" />
> >
> >      </Host>
>
> I really wouldn't do that. Overlapping the httpd DocumentRoot and a Tomcat
> docBase will open up a bunch of security issues unless you are extremely
> careful and know exactly what you are doing.
>
> You don't mention:
> - httpd version
> - Tomcat version
> - how you have linked the two
>
> Mark
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Virtual-Host issues on Apache-Tomcat

Posted by Mark Thomas <ma...@apache.org>.
Jonathan Mast wrote:
> I'm trying to a subdomain to our site but Tomcat is not finding the index
> page correctly.
> 
> Here are my entries into httpd.conf and server.xml:
> 
> <VirtualHost *>
>     ServerName foo.site.com
>     DocumentRoot /usr/local/apache/htdocs/foo
>         CustomLog /usr/local/apache/logs/foo.site.com_access_log combined
>         ErrorLog /usr/local/apache/logs/redirect.log
> 
> </VirtualHost>
> 
> 
> 
>      <Host name="foo.site.com"
>         unpackWARs="true" autoDeploy="false" >
>            <Context path="" docBase="/usr/local/apache/htdocs/foo" />
> 
>      </Host>

I really wouldn't do that. Overlapping the httpd DocumentRoot and a Tomcat 
docBase will open up a bunch of security issues unless you are extremely 
careful and know exactly what you are doing.

You don't mention:
- httpd version
- Tomcat version
- how you have linked the two

Mark


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