Configuration
Previous  Top  Next

To make sure that Apache is installed correctly, execute /usr/local/apache/bin/apachectl start and navigate to http://localhost/ and see if the default page appears. If it works stop Apache again issuing the same command with the stop option.

At this point Apache knows nothing about Tomcat or Cocoon, so we will need to tell Apache that we want it to pass certain requests to Tomcat using the webapps module.

To accomplish this we need to extract the file mod_webapps.so from webapp-module-1.0-tc40-linux-glibc2.2.tar.gz. This module is already compiled so we only need to copy the file mod_webapps.so to the /usr/local/apache/modules/ directory. You can create this directory if it doesn't exist yet.

Then add the following two lines to the file /usr/local/apache/conf/httpd.conf (after the Dynamic Shared Object (DSO)) section to use the newly installed module:

LoadModule webapp_module      modules/mod_webapp.so
AddModule mod_webapp.c


This will make Apache load the module every time it starts. To actually map a "virtual" subdirectory to Cocoon, add the following two lines anywhere (outside a directive like <directory> though) to httpd.conf:

WebAppConnection conn warp localhost:8008
WebAppDeploy cocoon conn /xmlconverter

The first line, WebAppConnection, creates a connection to the Tomcat server, running on the localhost on port 8008 – naming that connection conn. The keyword warp specifies how to connect, but warp seems to be the only supported option at the moment.
The second line, WebAppDeploy, maps the requested subdirectory xmlconverter to the /cocoon subfolder of the Tomcat webapps folder, using the previously defined connection.

It seems as if one has to start Tomcat before Apache, since the webapp module will otherwise complain that the cocoon web application has not yet been deployed. This can be tricky since Tomcat takes quite some time to start and "deploy" its web applications. I managed to solve this problem by loading Tomcat early (S40) and Apache very late (S98) in the boot process. Additionally I added a 20 seconds timeout to the /etc/init.d/httpd startup script.