Integrating Apache 2.0.x and Tomcat 4.1.x using mod_jk connector on SUSE 9
Novell Cool Solutions: Feature
By Thomas Yeung
|
Digg This -
Slashdot This
Posted: 14 Jan 2004 |
Thomas Yeung is a Software Enginer at Novell, Inc.
Update: We have made a correction to Step 12.
- By default, SUSE Linux Server 9 bundles with the Sun Java SDK. Hence, all we need to do is to set up the environment variable JAVA_HOME to point to the Java SDK directory. Edit the /etc/profile file add the JAVA_HOME variable at the end of the file:
export JAVA_HOME=/usr/lib/SunJava2-1.4.2
- Type "source /etc/profile" in the shell.
- Ensure the Apache 2.0.47 is installed on your system already. If not, use YaST (Install and Remove Software) to install the software. Select "Simple Webserver with Apache2" option in Selections filter.
- Install Jakarta Tomcat from YaST. Select "Package Groups" filter in "Install and Remove Software". Select "zzz All" from Package Groups. Check the "apache2-jakarta-tomcat-connectors" and "jakarta-tomcat" packages. The two packages will be installed from the SUSE Linux Server 9 CDs.
- Testing Tomcat by running the startup.sh from the Tomcat directory:
Type "/opt/jakarta/tomcat/bin/startup.sh" in the shell. - Open a web browser and enter "http://localhost:8080" as the URL and you should see the Tomcat web page.
- Edit the Tomcat server.xml file with your preferred editor:
e.g. vi /opt/jakarta/tomcat/conf/server.xml - Add the following lines immediately after the <Server port="8005"?> declaration:
- Comment out (using <-- and --> ) the following paragraph after this declaration:
- Uncomment the following paragraph after this declaration:
- Finally, add the following lines after <Host name="localhost"> declarations, add a listener:
- Create a directory called "jk" under /opt/jakarta/tomcat/conf
- Edit workers.properties file in the /opt/jakarta/tomcat/conf directory and make it look like the following:
- Stop and start Tomcat using shutdown.sh and startup.sh in the Tomcat bin directory. If everything worked correctly, you will now have a mod_jk.conf file in /opt/jakarta/tomcat/conf/auto directory.
- Edit the httpd.conf file to include mod_jk.conf. Add the following lines to the end of the LoadModule section:
- Test httpd.conf by typing the following:
- Restart Apache2 by enter the following:
- Open a web browser and test the mod_jk connector.
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"
modJk="/usr/lib/apache2/mod_jk.so" jkDebug="info"
workersConfig="/opt/jakarta/tomcat/conf/workers.properties"
jkLog="/opt/jakarta/tomcat/logs/mod_jk.log"/>
<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
<!-- (add this)
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8009" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="0"
useURIValidationHack="false"
protocolHandlerClassName="org.apache.jk.server
.JkCoyoteHandler"/>
--> (add this)
<!-- Define an AJP 1.3 Connector on port 8009 -->
<!-- (remove this)
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
port="8009" minProcessors="5" maxProcessors="75"
acceptCount="10" debug="0"/>
--> (remove this)
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"
append="true" />
workers.CATALINA_HOME=/opt/jakarta/tomcat workers.java_home=$(JAVA_HOME) ps=/ worker.list=ajp13 worker.ajp13.port=8009 worker.ajp13.host=localhost worker.ajp13.type=ajp13 worker.ajp13.lbfactor=1 worker.loadbalancer.type=lb worker.loadbalancer.balanced_workers=ajp13 worker.inprocess.type=jni worker.inprocess.class_path=$(workers.CATALINA_HOME)$(ps)lib$(ps)tomcat.jar worker.inprocess.cmd_line=start worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)libjvm.so worker.inprocess.stdout=$(workers.CATALINA_HOME)$(ps)logs$(ps)inprocess.stdout worker.inprocess.stderr=$(workers.CATALINA_HOME)$(ps)logs$(ps)inprocess.stderr
Include /opt/jakarta/tomcat/conf/auto/mod_jk.conf
/etc/init.d/apache2 configtest
/etc/init.d/apache2 restart
http://localhost/examples
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

