本文发表在 rolia.net 枫下论坛*******************************************************************************************************
** Configuration Guide for Apache HTTPd/Tomcat AJP13 Connector configuration using the JK2 Connector **
*******************************************************************************************************
Assumed OS: Windows NT/2K/XP
Assumed Environment:
APACHE_HOME c:\apache2
<<< (How to set up the basic environment)
1) acquire win32 binary of the jk2 connector module (mod_jk2-2.0.43.dll)
from http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk2/release/v2.0.2/bin/win32/
copy to C:\apache2\modules
Note: although the connector's file name explicitly references apache version 2.0.43, it works
perfectly well with versions of apache higher than 2.0.43 (such as 2.0.45)
Also Note: if you are using apache 1.3.27 or higher you must use mod_jk2-1.3.27.dll
2) in the path: "c:\apache2\logs" create an empty file called: "shm.file"
3) add file C:\apache2\conf\workers2.properties
add the entire file contents below
---> start (do not cut this line to clipboard)
# BOF - workers2.properties
# $Date: 2003/06/05 12:30:00
# $Author: Alexander Petty
# $Application: (Apache 2.0.45) --ajp13--> (JBoss 3.2.1 and Jakarta-Tomcat 4.1.24)
#
# comment out for production server
# [logger.apache2]
# level=DEBUG
[shm]
file=c:/apache2/logs/shm.file
size=1048576
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=localhost
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# Uri mapping
[uri:[your_machines_ip_address]/*.jsp]
worker=ajp13:localhost:8009
[uri:[your_machines_ip_address]/servlet/*]
worker=ajp13:localhost:8009
[uri:[your_machines_ip_address]/[desired_uri]/*]
worker=ajp13:localhost:8009
[uri:[your_machines_hostname]/*.jsp]
worker=ajp13:localhost:8009
[uri:[your_machines_hostname]/servlet/*]
worker=ajp13:localhost:8009
[uri:[your_machines_ip_hostname]/[desired_uri]/*]
worker=ajp13:localhost:8009
#
# EOF - workers2.properties
---> end file (do not cut this line to clipboard)
4) edit the sections of this workers2.properties titled:
Uri mapping
Ensure that the bracketed variables [your_machines_ip_address],
[your_machines_hostname], and [desired_uri] are replaced with
information specific to your server.
newbies: completely exclude any lines with reference to [desired_uri] until
you understand how a desired_uri might benefit you.
Note: Any hostname/address that resolves to your server needs to be included here. JK2 will
not resolve any names dynamically, so if they are not listed in this file your
configuration will not properly handle servlet requests for the given name.
Also Note: Optional: If you are using virtual directories with apache you may use at the
bottom of the default virtualhost tag the tag parameters:
<Location "/*.jsp"> JkUriSet ajp13:localhost:8009 </Location>
<Location "/servlet/*"> JkUriSet ajp13:localhost:8009 </Location>
This configuration will allow you to comment/remove the entire "uri mapping"
section of workers2.properties and manage the uri mappings from http.conf
5) edit file C:\apache2\conf\httpd.conf
find the sction titled :
# Dynamic Shared Object (DSO) Support
add directly beneath it:
LoadModule jk2_module modules/mod_jk2-2.0.43.dll
6) restart apache httpd server and start Tomcat
7) open a browser and test http://[your_machines_hostname]
you should see apache test page
8) open a browser and test http://[your_machines_hostname]:8080
you should see tomcat page
9) open a browser and test http://[your_machines_hostname]/servlet/test.html
10) open a browser and test http://[your_machines_hostname]/test.jsp
if you see tomcat error page indicating no configured context, apj13 connector is working properly
11) if steps 9 and 10 did not show you the Tomcat no context error message, then redo all the above steps
this time read the steps more carefully!!!
********************************************************************************************************
** You have successfully completed the Apache HTTPd/Tomcat AJP13 Connector configuration successfully **
********************************************************************************************************更多精彩文章及讨论,请光临枫下论坛 rolia.net
** Configuration Guide for Apache HTTPd/Tomcat AJP13 Connector configuration using the JK2 Connector **
*******************************************************************************************************
Assumed OS: Windows NT/2K/XP
Assumed Environment:
APACHE_HOME c:\apache2
<<< (How to set up the basic environment)
1) acquire win32 binary of the jk2 connector module (mod_jk2-2.0.43.dll)
from http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk2/release/v2.0.2/bin/win32/
copy to C:\apache2\modules
Note: although the connector's file name explicitly references apache version 2.0.43, it works
perfectly well with versions of apache higher than 2.0.43 (such as 2.0.45)
Also Note: if you are using apache 1.3.27 or higher you must use mod_jk2-1.3.27.dll
2) in the path: "c:\apache2\logs" create an empty file called: "shm.file"
3) add file C:\apache2\conf\workers2.properties
add the entire file contents below
---> start (do not cut this line to clipboard)
# BOF - workers2.properties
# $Date: 2003/06/05 12:30:00
# $Author: Alexander Petty
# $Application: (Apache 2.0.45) --ajp13--> (JBoss 3.2.1 and Jakarta-Tomcat 4.1.24)
#
# comment out for production server
# [logger.apache2]
# level=DEBUG
[shm]
file=c:/apache2/logs/shm.file
size=1048576
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=localhost
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# Uri mapping
[uri:[your_machines_ip_address]/*.jsp]
worker=ajp13:localhost:8009
[uri:[your_machines_ip_address]/servlet/*]
worker=ajp13:localhost:8009
[uri:[your_machines_ip_address]/[desired_uri]/*]
worker=ajp13:localhost:8009
[uri:[your_machines_hostname]/*.jsp]
worker=ajp13:localhost:8009
[uri:[your_machines_hostname]/servlet/*]
worker=ajp13:localhost:8009
[uri:[your_machines_ip_hostname]/[desired_uri]/*]
worker=ajp13:localhost:8009
#
# EOF - workers2.properties
---> end file (do not cut this line to clipboard)
4) edit the sections of this workers2.properties titled:
Uri mapping
Ensure that the bracketed variables [your_machines_ip_address],
[your_machines_hostname], and [desired_uri] are replaced with
information specific to your server.
newbies: completely exclude any lines with reference to [desired_uri] until
you understand how a desired_uri might benefit you.
Note: Any hostname/address that resolves to your server needs to be included here. JK2 will
not resolve any names dynamically, so if they are not listed in this file your
configuration will not properly handle servlet requests for the given name.
Also Note: Optional: If you are using virtual directories with apache you may use at the
bottom of the default virtualhost tag the tag parameters:
<Location "/*.jsp"> JkUriSet ajp13:localhost:8009 </Location>
<Location "/servlet/*"> JkUriSet ajp13:localhost:8009 </Location>
This configuration will allow you to comment/remove the entire "uri mapping"
section of workers2.properties and manage the uri mappings from http.conf
5) edit file C:\apache2\conf\httpd.conf
find the sction titled :
# Dynamic Shared Object (DSO) Support
add directly beneath it:
LoadModule jk2_module modules/mod_jk2-2.0.43.dll
6) restart apache httpd server and start Tomcat
7) open a browser and test http://[your_machines_hostname]
you should see apache test page
8) open a browser and test http://[your_machines_hostname]:8080
you should see tomcat page
9) open a browser and test http://[your_machines_hostname]/servlet/test.html
10) open a browser and test http://[your_machines_hostname]/test.jsp
if you see tomcat error page indicating no configured context, apj13 connector is working properly
11) if steps 9 and 10 did not show you the Tomcat no context error message, then redo all the above steps
this time read the steps more carefully!!!
********************************************************************************************************
** You have successfully completed the Apache HTTPd/Tomcat AJP13 Connector configuration successfully **
********************************************************************************************************更多精彩文章及讨论,请光临枫下论坛 rolia.net