A.软件准备
j2sdk-1_4_2_04-windows-i586-p
Apache2.0.52
jakarta-tomcat-5.0.28
mod_jk-1.2.14-apache-2.0.54
B.安装
apache 安装到C:ApacheApache2
tomcat 安装到c:tomcat
jdk 安装到d:j2sdk1.4.2_04
C.环境变量设置
安装j2sdk以后,需要配置一下环境变量,在我的电脑->属性->高级->环境变量->系统变量中添加以下环境变量(假定你的j2sdk安装在c:j2sdk1.4.2):
JAVA_HOME=c:j2sdk1.4.2
classpath=.;%JAVA_HOME%libdt.jar;%JAVA_HOME%libtools.jar;(.;一定不能少,因为它代表当前路径)
path=%JAVA_HOME%bin
安装Tomcat后,在我的电脑->属性->高级->环境变量->系统变量中添加以下环境变量(假定你的tomcat安装在c:tomcat):
CATALINA_HOME=c:tomcat;
CATALINA_BASE=c:tomcat;
d:配置
apache配置:
1、mod_jk.so(不是这个名字的话请重命名为此名字)复制到modules目录下;
2、编辑一个workers.properties文件,放在Apache的conf目录下,添加如下内容
[shm]
file=C:/Apache/Apache2/logs/shm.file #根据实际安装的目录
size=1048576
#The socket channel,最关键的部分,定义与Apache的交互IP和端口
[channel.socket:localhost:8009]
port=8009
host=localhost
#define the worker,应该是定义与Apache的通道,用的是ajp13引擎指向8009端口
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
#uri mapping,对servlet和jsp的映射,这里还可以加入do文件等的映射,注意用的是ajp13引擎
[uri:/*]
[uri:/*.jsp]
worker=ajp13:localhost:8009
3、对于httpd.conf文件的处理,是最关键的一步,末尾添加内容如下:
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
ServerAdmin [email protected]
DocumentRoot "c:/Tomcat/webapps/ROOT"
ServerName 127.0.0.1
ErrorLog logs/k99k.com-error_log
CustomLog logs/k99k.com-access_log common
DirectoryIndex index.html index.htm index.jsp Read
# Send servlet用ajp13引擎,对于像/*这样的请求
JkMount /* ajp13
# Send JSPs用ajp13引擎,对于像/*.jsp这样的请求
JkMount /*.jsp ajp13
Tomcat配置
1、在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,channelSocket
#
# Override the default port for the socketChannel
channelSocket.port=8019
# Default:
# channelUnix.file=${jkHome}/work/jk2.socket
# Just to check if the the config is working
# shm.file=${jkHome}/work/jk2.shm
# In order to enable jni use any channelJni directive
# channelJni.disabled = 0
# And one of the following directives:
声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。