Cocoon virtual hosting with apache at front

For the last 2 years we serve several cocoon based web sites with Apache at front.

The Box

cocoon 2.0.4 (apache at front with mod_proxy)
tomcat 4.1.24
redhat linux
jdk 1.4

Here are our configuration files.

Cocoon

Sitemap (sitemap.xmap)

In the main cocoon sitemap we have add a pipeline:

  <map:pipeline>
    <!-- vhost sub -->
     <map:match pattern="*.gr/**">
        <map:mount uri-prefix="{1}.gr" src="/home/vhost/xml/{1}.gr/htdocs/sitemap.xmap" check-reload="yes"/>
     </map:match>
  </map:pipeline>

all our virtual hosted sites are in /home/vhost/xml/{domain-name}.gr/htdocs (we host sites in .gr domain) with sub sitemap in htdocs directory

We can get each site directly from tomcat using:

http://{our.webserver.ip}:8080/cocoon/{domain-name}.gr/

Apache

There is a configuration file for each domain:
in this example some directories contain static content and are server from apache to save load from cocoon.

<VirtualHost *:80>

<Directory /home/vhost/xml/{domain-name}.gr/htdocs>
Options -Indexes
order allow,deny
allow from all
</Directory>

        ServerAdmin webmaster@osmosis.gr
        DocumentRoot /home/vhost/xml/{domain-name}.gr/htdocs
        ServerName *.{domain-name}.gr
        ServerAlias {domain-name}.gr *.{domain-name}.gr
        ErrorLog /home/vhost/xml/{domain-name}.gr/logs/{domain-name}.gr.error_log
        CustomLog /home/vhost/xml/{domain-name}.gr/logs/{domain-name}.gr.access_log combined

<Location /WEB-INF>
    Order deny,allow
    Deny from all
</Location>

#static content is served from apache
ProxyPass /media/ !
ProxyPass /stats/ !
ProxyPass /images/ !
ProxyPass /themes/images/ !

#all the rest are passed to cocoon
ProxyPass / http://localhost:8080/cocoon/{domain-name}.gr/
ProxyPassReverse / http://localhost:8080/cocoon/{domain-name}.gr/

ProxyErrorOverride On

</VirtualHost>

VirtualHost (last edited 2009-09-20 23:42:12 by localhost)