This document covers how to setup Apache 2, Tomcat 4 and mod_jk on
Solaris 7 - 9. Solaris 10 has Tomcat included as a base component.
Prerequisites (you can get these from sunfreeware or blastwave)
autoconf
automake
binutils
gcc (I used version 2.95.3)
glib
gzip
libtool
make
gnu tar
wget
zlib
Apache
Download Apache source from a mirror
Unzip it
Build apache with:
./configure --prefix=/usr/local/apache2 --enable-ssl --enable-module=so
When configure completes, run make.
When make completes, run make install.
You should now have an Apache instance in /usr/local/apache2. Verify config: /usr/local/apache2/bin/apachectl configtest
If you get a "Syntax OK" message, startup Apache: /usr/local/apache2/bin/apachectl start
Verify Apache is running: http://some.server.name You should see the Apache welcome page
JDK
Go to java.sun.com and download J2SE for Solaris
Set JAVA_HOME as an environment variable, pointing to the location of the J2SE you just installed.
Tomcat
Download the Tomcat binary package from the Jakarta website
Unzip it to /usr/local. You should end up with /usr/local/jakarta-tomcat-4.1.12
Add a symbolic link: ln -s /usr/local/jakarta-tomcat-4.1.12 /usr/local/tomcat
Set CATALINA_HOME as an environment variable, pointing to /usr/local/tomcat
Startup Tomcat to test your installation: /usr/local/tomcat/bin/startup.sh. Verify the Tomcat examples are available at http://some.server.name:8080/examples
JK
Download the connector source from the Jakarta site
Unpack it to /usr/local/src/
From this point on, CONNECTOR_HOME = /usr/local/src/jakarta-tomcat-connectors-jk-1.2.0-src
cd CONNECTOR_HOME/jk/native
run the buildconf script: ./buildconf.sh
you may see some error messages about aclocal and autom4te...these can be ignored.
run the configure script: ./configure --with-apxs=/some/path/to/apache2/bin/apxs
run make
the mod_jk.so file will be in CONNECTOR_HOME/jk/native/apache-2.0. Copy it to your Apache modules directory.
Final Configuration
These steps will allow access to the Tomcat examples via Apache on port 80. Successful use of the examples on port 80 shows that mod_jk is working correctly, since Tomcat is configured to run on port 8080 by default for HTTP requests.
Edit server.xml in CATALINA_HOME/conf.
look for a line that says "Server" and has a port of 8005. Add the following directly below:
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" modJk="/usr/local/apache2/modules/mod_jk.so" />
In the Host container add the following Listener directive (yes, it looks very similar to the one above):
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" append="true" forwardAll="false" modJk="/usr/local/apache2/modules/mod_jk.so" />
change the name parameter in the Host directive to your apache ServerName (the default is localhost)
Edit httpd.conf in APACHE_HOME/conf.
- make sure your ServerName matches the name="" parameter in your tomcat Host element in server.xml
- add the following line at the very end:
Include /usr/local/tomcat/conf/auto/mod_jk.conf
Note: the mod_jk.conf file gets created by tomcat when tomcat starts. It gets created every time tomcat starts. So, if you have your server.xml configured, you can ignore httpd.conf (in most cases) except to add the Include directive for mod_jk.conf. You don't need to create or edit mod_jk.conf. Click here for a sample mod_jk.conf file generated automatically by tomcat on each startup.
Create a file in CATALINA_HOME/conf/jk called workers.properties. That file should look like this:
# BEGIN workers.properties
worker.list=ajp13
worker.ajp13.port=8009
# change this line to match apache ServerName and Host name in server.xml
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
# END workers.properties
Startup tomcat: $CATALINA_HOME/bin/startup.sh
Wait at least 10 seconds for tomcat to finish. Start apache: /usr/local/apache2/bin/apachectl start
Verify examples at http://localhost:8080/examples. On success, tomcat is working correctly.
Verify examples at http://localhost/examples. On success, apache is working correctly, and JSP and servlet requests are being passed to tomcat.
