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.
- Fronting Razuna with the Apache 2.x web server
- Configure Tomcat and Apache for HTTP
- Configure Tomcat and Apache for AJP
Configure Tomcat and Apache for HTTPBy 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”. If you want to use SSL only also add the “Headers” module.
Once done you can configure a virtual host to pass on requests to Tomcat. Below you will find a example configuration:
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).