From OpenNMS
Contents |
Rational
I personally hate urls which include "8080" and there are some other good reasons to not expose bizarre ports to the outside world. Apart of that - I like Apache. However, I'm convinced you could achieve the same just with more tomcat configuration skills.
Though - there might be other reasons to use apache (like..you need php4 as well on the opennms box..or opennms is not the only application on the machien), still.
In addition, I use mod_ssl because we have a policy that no passwords are sent around the network in cleartext.
Implementation
To get this to work, you need three things
- A working webUI of opennms using tomcat
- Mod_JK
- Apache
I use apache 1.3 but for version 2 the idea is the same.
mod_jk
When you install mod_jk, it should come with a working workers file (sic!). The mod_jk debian package installs this workers file in the most bizarre place of /etc/libapache-mod-jk.
more workers.properties # Tomcat and Java configuration # workers.tomcat_home=/usr/share/tomcat4 workers.java_home=/usr/lib/j2se/1.4 ps=/ worker.list=local # Definition for local worker using AJP 1.3 # worker.local.type=ajp13 worker.local.host=localhost worker.local.port=8009
Tomcat
The port 8009 is used to speak to Tomcat and finds itself in the tomcat configuration (in ~/tomcat5/conf/server.xml):
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
But again, you should not need to do this. The vanilla installation of Apache should listen on port 8009. The idea is the same for tomcat4, the location where this is put might be different.
Apache
The final glue has to be put into the Apache configuration. If you are a good guy, you separate your basic configuration from the server-specific.
In httpd.conf or modules conf, you need to load mod_jk:
LoadModule jk_module /usr/lib/apache/1.3/mod_jk.so
(here for apache 1.3)
in my conf.d/ directory, I use a specific file for jk (jk.conf):
JkWorkersFile /etc/libapache-mod-jk/workers.properties JkLogFile /var/log/apache/mod_jk.log JkLogLevel info JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
Well - Debian did it for me ;-)
In the configuration file for the Virtual Server you add - within the VirtualHost directive:
JkMount /opennms/* local
The way this works is pretty much the same as for an Alias directive: All the URLs containing /opennms/ will be directed to the worker and be handled through mod_jk via port 8009 by tomcat (and the already installed opennms webapp).
SSL
To use SSL, create a virtual Host which does SSL and mount the /opennms/ in it, it's that easy. There are plenty of tutorials on "how to create a ssl server with apache" in the web.






