日期:2014-05-16 浏览次数:20778 次
运行环境:Windows7
一、安装程序
1. 安装jdk-6u11(jdk-6u11-windows-i586-p.exe文件)
将其安装在D:\Program Files\Java\jdk1.6.0_11下
2. 安装Apache服务器 (httpd-2.2.17-win32-x86-no_ssl.msi)
运行Apache的自动安装包,安装Apache2.2.17到
D:\Program Files\Apache Software Foundation\Apache2.2目录下。
3. 安装Tomcat服务器 (japache-tomcat-6.0.24.exe)
运行Tomcat的自动安装包,安装
Tomcat 6.0到D:\Program Files\Apache Software Foundation\Tomcat 6.0目录下。
4. 安装mod_jk (mod_jk-1.2.30-httpd-2.2.3.so)
拷贝mod_jk-1.2.30-httpd-2.2.3.so文件到
D:\Program Files\Apache Software Foundation\Apache2.2\modules文件夹下。
下载地址:http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.30/
5. 准备工作目录和测试文件
在E:盘新建目录www,并创建一个基本的index.jsp文件,源码如下所示:
1.配置Apache服务器
编辑httpd.conf文件,在文件的最后添加如下内容:?
# Using mod_jk2.dll to redirect dynamic calls to Tomcat LoadModule jk_module "D:/Program Files/Apache Software Foundation/Apache2.2/modules/mod_jk-1.2.30 -httpd-2.2.3.so" JkWorkersFile "D:/Program Files/Apache Software Foundation/Tomcat 6.0/conf/workers.properties" JkLogFile "D:/Program Files/Apache Software Foundation/Tomcat 6.0/logs/mod_jk2.log" JkLogLevel info JkMount /servlet/* ajp13 JkMount /*.jsp ajp13 Alias /web "E:/www/" <Directory "E:/www"> Options Indexes MultiViews AddOutputFilter Includes html AllowOverride None Order allow,deny Allow from all </Directory>
?
2.配置Tomcat服务器
1、建立workers.properties文件
在D:/Program Files/Apache Software Foundation/Tomcat 6.0/conf/目录下新建文本文档并命名为
workers.properties,写入如下内容:
workers.tomcat_home=D:\Program Files\Apache Software Foundation\Tomcat 6.0 workers.java_home=D:\Program Files\Java\jdk1.6.0_11 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=ajp12, ajp13 worker.inprocess.type=jni worker.inprocess.class_path=$(workers.tomcat_home)$(ps)classes worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)jaxp.jar worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)parser.jar worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)jasper.jar worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)servlet.jar worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)webserver.jar worker.inprocess.class_path=$(workers.java_home)$(ps)lib$(ps)tools.jar worker.inprocess.cmd_line=-config worker.inprocess.cmd_line=$(workers.tomcat_home)/conf/jni_server.xml worker.inprocess.cmd_line=-home worker.inprocess.cmd_line=$(workers.tomcat_home) worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)jvm.dll worker.inprocess.stdout=$(workers.tomcat_home)$(ps)inprocess.stdout worker.inprocess.stderr=$(workers.tomcat_home)$(ps)inprocess.stderr worker.inprocess.sysprops=tomcat.home=$(workers.tomcat_home)
?2、修改server.xml文件
在D:\Program Files\Apache Software Foundation\Tomcat 6.0\conf 目录下找到server.xml文件,用文本文档
打开后查找</HOST>。
在</HOST>的前一行加入如下内容:
<Context path="/web" docBase="E:/www" debug="0" reloadable="true" > </Context>
?3、修改jk2.properties文件
在D:\Program Files\Apache Software Foundation\Tomcat 6.0\conf 目录下找到(或者新建)jk2.properties文
件,用文档打开并删除所有内容。
将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=8019 # Default: # channelUnix.file=$