在借鉴了大量的文章后,捣鼓这套配置也用了差不多2个整晚上;现在基本摸索出了套路;按下面的程序办肯定没有问题
版本:
apache_2.0.49-win32-x86-no_ssl.msi
jakarta-tomcat-connectors-jk2.0.4-win32-apache2.0.49.zip
jakarta-tomcat-5.0.28.exe
JDK1.4.2_10
程序:
一
安装
JDK
二
安装
Tomcat http://localhost:8080/
可访问
三
安装
Httpd http://localhost
可访问
四
解压缩
connectors
五
声明
$httpd
为
apache httpd
的安装目录,
如
D:\programfiles\javas\apache\Apache2
$tomcat
为
Tomcat
的安装目录,
如
D:\programfiles\javas\Tomcat5028
六
集成
1
拷贝
connectors
解压缩获得的
modules\mod_jk2.so
到
$httpd\modules
2
拷贝
connectors
解压缩获得的
conf \
workers2.properties.sample
到
$httpd\conf
并改名为
workers2.properties
3
修改
$httpd\conf\httpd.conf
文件
主要修改的位置:
3.1
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
# DocumentRoot "D:/programfiles/javas/apache/Apache2/htdocs"
DocumentRoot "$Tomcat/webapps/"
3.2
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "$Tomcat/webapps/">
3.3
# Where to find the workers2.properties file
<IfModule mod_jk2.c>
JkSet config.file $Httpd/conf/workers2.properties
</IfModule>
3.4
<VirtualHost *:80>
ServerName localhost
ServerAlias domain.com *.domain.com
DocumentRoot $Tomcat/webapps/
<Location "/*.jsp">
JkUriSet worker ajp13:localhost:8009
</Location>
</VirtualHost>
3.5
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule jk2_module modules/mod_jk2.so
4
修改
$httpd\conf\ workers2.properties
文件
改后内容大概如下:
# Set a Logger
[logger.apache2]
file=$httpd/error/error.log
level=INFO
debug=1
# config settings
[config]
file=$httpd/conf/workers2.properties
level=INFO
debug=1
# Shared Memory file settings
[shm]
info=Scoreboard. Requried for reconfiguration and status with multiprocess servers.
file=$httpd/logs/jk2.shm
size=1048576
# Defines a load balancer named lb. Use even if you only have one machine.
[lb:lb]
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
group=lb
# Map the Tomcat examples webapp to the Web server uri space
[uri:/*.jsp]
worker=ajp13:localhost:8009
5
修改
$Tomcat\conf\ jk2.properties
文件
## THIS FILE MAY BE OVERRIDEN AT RUNTIME. MAKE SURE TOMCAT IS STOPED
## WHEN YOU EDIT THE FILE.
## COMMENTS WILL BE _LOST_
## DOCUMENTATION OF THE FORMAT IN JkMain javadoc.
# Set the desired handler list
# handler.list=apr,request,channelJni
#
# Override the default port for the socketChannel
channelSocket.port=8009
# Default:
# channelUnix.file=${jkHome}/work/jk2.socket
# Just to check if the the config is working
shm.file=D:/programfiles/javas/apache/Apache2/logs/jk2.shm
# In order to enable jni use any channelJni directive
# channelJni.disabled = 0
# And one of the following directives:
apr.jniModeSo=D:/programfiles/javas/apache/Apache2/modules/mod_jk2.so
# If set to inprocess the mod_jk2 will Register natives itself
# This will enable the starting of the Tomcat from mod_jk2
# apr.jniModeSo=inprocess
大功告成。只要你把要发布的东西放到
$Tomcat/webapps
下就可以正常访问了