Begin main content

Tomcat/Apache virtual hosting

Damn using Tomcat with Apache is complicated—furthering my belief that java web development is over complicated just for the sake of it :/

After hours of frustration I thought I'd better blog my findings to save others frustration in the future, having not found a comprehensive solution elsewhere. I'll be incrementally adding to this entry, so here goes...

1.
Install Tomcat 5 and the ajp13 connector as normal, and verify it works (checkout /jsp-examples/, /manager/html/ etc.)

2.
For a virtual host that you already have working in Apache, add an entry to your ${CATALINA_HOME}/conf/server.xml following this template (replacing ${CATALINA_HOME} with your tomcat home):

<Host name="www.domain.com.au" debug="5" appBase="webapps" unpackWARs="true">
   <Alias>domain.com.au</Alias>
   <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="consbh." suffix=".log" timestamp="true"/>
   <Context path="" docBase="/path/to/website/htdocs" debug="5" reloadable="true"/>
   <Context path="/manager" debug="5" privileged="true" docBase="${CATALINA_HOME}/server/webapps/manager" />
</Host>

3.
In your relevant apache conf file add to each virtual host directive following this template (replacing ${CATALINA_HOME} with your tomcat home):

JkMount "/*.jsp" ajp13
JkMount /manager/* ajp13
Alias /manager/ ${CATALINA_HOME}/server/webapps/manager

4.
Now how to get a unique login realm for each virtual host /manager/? Well I've been at it all morning and do you reckon I've figured it out yet?? Grrr.

5.
Add to the frustration that in Apache there seems to be no way (outside writing an apache module&#8212which I may yet do) to say something like "If you (Apache) can't resolve a request to a file, please do this action". You can forward to a 404 handler script which I'm sure can get the original url from an ENV variable&#8212;but it would have to know how to handle that situation. This task is easy as pie in AOLserver...

Unfortunately I can't even get JkMount "/*.do" ajp13 to work on this server (for struts handler use). Time for more troubleshooting :(

More to come...

09:45 PM, 03 Feb 2004 by Mark Aufflick Permalink | Comments (0)

Sure it doesn't close...

But at least it tilts nice and safely now!

You can also see the bodgy lines at the bottom of the screen in this shot - they seek to come and go. I'm not complaining.

02:33 AM, 03 Feb 2004 by Mark Aufflick Permalink | Comments (0)

XML

Blog Categories

software (40)
..cocoa (21)
  ..heads up 'tunes (5)
..ruby (6)
..lisp (4)
..perl (4)
..openacs (1)
mac (21)
embedded (2)
..microprocessor (2)
  ..avr (1)
electronics (3)
design (1)
photography (26)
..black and white (6)
..A day in Sydney (18)
..The Daily Shoot (6)
food (2)
Book Review (2)

Notifications

Icon of envelope Request notifications

Syndication Feed

XML

Recent Comments

  1. Unregistered Visitor: mmh
  2. Mark Aufflick: Thank you
  3. Unregistered Visitor: Filenames with hyphens
  4. Unregistered Visitor: normal
  5. Unregistered Visitor: mel kaye that died in 2011
  6. Unregistered Visitor: Contacts cats vs. email cats
  7. Mark Aufflick: Thanks for the update
  8. Unregistered Visitor: Correction...
  9. Unregistered Visitor: Update on Mel...
  10. Unregistered Visitor: Error