Tomcat with virtual hosts - 404

Posted by Thardas on Server Fault See other posts from Server Fault or by Thardas
Published on 2009-08-10T09:26:20Z Indexed on 2010/04/11 1:03 UTC
Read the original article Hit count: 382

Filed under:
|
|
|

I have a CentOS 5.2 server set up with Apache 2.2.3 and Tomcat 5.5.27. The server hosts multiple virtual hosts connected to multiple Tomcats. For instance we have one tomcat for development and testing and one tomcat for production. project.demo.us.com points to dev tomcat and project.us.com points to production tomcat.

Here's the virtual host's configuration:

<VirtualHost *:80>
    ServerName project.demo.us.com

    CustomLog logs/project.demo.us.com/access_log combined env=!VLOG
    ErrorLog logs/project.demo.us.com/error_log
    DocumentRoot /var/www/vhosts/project.demo.us.com

    <Directory /var/www/vhosts/project.demo.us.com>
            Allow from all
            AllowOverride All
            Options -Indexes FollowSymLinks
    </Directory>

    ##########
    ##########
    ##########

    JkMount /project/* online
</VirtualHost>

JkMount line defines that we use online worker and our workers.properties contains this:

worker.list=..., online, ...

worker.online.port=7703
worker.online.host=localhost
worker.online.type=ajp13
worker.online.lbfactor=1

And tomcat's conf/server.xml contains:

    <Connector port="7703" 
      enableLookups="false" redirectPort="8443" protocol="AJP/1.3" 
      URIEncoding="UTF-8" maxThreads="80"
      minSpareThreads="10" maxSpareThreads="15"/>

I'm not sure what redirectPort is but I tried to telnet to that port and there's no one answering, so it shouldn't matter?

Tomcat's webapps directory contains project.war and the server automatically deployed it under project directory which contains index.jsp and hello.html. The latter is for static debugging purposes.

Now when I try to access http://project.demo.us.com/project/index.jsp, I get Tomcat's HTTP Status 404 - The requested resource () is not available. The same thing happens to hello.html so it's not working with static content either.

Apache's access_log contains:

88.112.152.31 - - [10/Aug/2009:12:15:14 +0300] "GET /demo/index.jsp HTTP/1.1" 404 952 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2"

I couldn't find any mention of the request in Tomcat's logs.

If I shutdown this specific tomcat, I no longer get Tomcat's 404 but Apache's 503 Service Temporarily Unavailable, so I should be configuring the correct Tomcat.

Is there something obvious that I'm missing? Is there any place where I could find out what path the Tomcat is using to look for requested files?

© Server Fault or respective owner

Related posts about apache2

Related posts about tomcat