Skip to end of metadata
Go to start of metadata

Fronting Razuna with the Apache 2.x web server

There are many advantages to fronting the default J2EE server (Tomcat 6.x) that comes with Razuna. One of them is to load the static files off to Apache, while Tomcat only serves the dynamic content.

There are 2 kind of adapter to talk to Tomcat. There is the "native" HTTP protocol and the other is the AJP one. We do recommend the HTTP one.

Configure Tomcat and Apache for HTTP

By default Tomcat comes with the native HTTP protocol enabled. So there is actually nothing to do on the Tomcat side.

For Apache to pass off requests to Tomcat you need to enable the "mod_proxy" and "mod_proxy_http" modules. How to do this depends on your Linux distribution. On Ubuntu it is a simple command like "a2enmod proxy_http".

Once done you can configure a virtual host to pass on requests to Tomcat. Below you will find a example configuration:

With this virtual host container we actually tell Apache to request any static file from the razuna directory and any static content from Tomcat (this is done with the rewriteEngine rules at the bottom).

Configure Tomcat and Apache for AJP

By default Tomcat comes enabled with the AJP protocol. If not, make sure the following like is not commented:

If commented, restart Tomcat after you changed this line.

Now all there is to do is to tell Apache to get the dynamic pages from Tomcat.

In order to have AJP working in Apache you will need to include the mod_proxy_ajp.mod in your apache configuration. On CentOS/RedHat simply uncomment the lines in the http.conf file, for Ubuntu do a "sudo a2enmod mod_proxy_ajp.conf"

With this virtual host container we actually tell Apache to request any static file from the razuna directory and any static content from Tomcat (this is done with the rewriteEngine rules at the bottom).

Labels:
  1. May 16, 2012

    Anonymous

    There is an error in Configure Tomcat and Apache for HTTP.

    In the rewrite section we don't use ajp protocol but http, so the correct is:

    RewriteRule ^/(.*\.cf[cm]/?.*)$ http://localhost:8009/$1 [P] 

    1. May 16, 2012

      Ah, yes. Typo. Fixed it now. Thank you.