本机环境:
操作系统:Windows2000Sp4,
Java:C:\Program Files\Java\jdk1.5.0_05
假设本机上没有Apache和Tomcat存在,如果存在就全部卸载删除。
1、下载安装Apache2
下载路径:
http://apache.bestwebcover.com/httpd/binaries/win32/apache_2.0.55-win32-x86-no_ssl.msi
安装到:(为了防止空格导致的麻烦,ApacheGroup中间没有空格)
C:\ApacheGroup
会自动生成
C:\ApacheGroup\Apache2
选择安装为Windows的Service后会自动启动。
启动浏览器观察http://localhost看到Apache的默认主页。
2、下载安装Tomcat5.5
下载路径:
http://mirrors.playboy.com/apache/tomcat/tomcat-5/v5.5.12/bin/apache-tomcat-5.5.12.exe
安装到:(为了防止空格导致的麻烦,Tomcat5.5中间没有空格)
C:\ApacheGroup\Tomcat5.5
自动安装为Service,选择安装完毕后启动Tomcat。
安装时选择安装examples。
启动浏览器观察http://localhost:8080看到Tomcat的默认主页。
观测http://localhost:8080/jsp-examples看到jsp测试页。
3、下载安装Connector
下载路径:
http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.15/mod_jk-apache-2.0.55.so
改名为mod_jk.so后放到C:\ApacheGroup\Apache2\modules下面。
4、创建workers.properties,放到C:\ApacheGroup\Apache2\conf下面。基本上按照Apache网站上Connector的worker的介绍写的,就是目录按照前面的实际安装目录写。
workers.apache_log=C:\ApacheGroup\Apache2\logs
workers.tomcat_home=C:\ApacheGroup\Tomcat5.5
ps=# the list of workers
worker.list=ajp13
# worker "ajp13" will talk to Tomcat listening on machine localhost at port 8009 using 3 lb factor
worker.ajp13.type=ajp13
worker.ajp13.host=localhost
worker.ajp13.port=8009
worker.ajp13.lbfactor=3
# worker "ajp13" use up to 10 sockets, which will stay no more than 10mn in cache
worker.ajp13.cachesize=10
worker.ajp13.cache_timeout=600
# worker "ajp13" ask operating system to send KEEP-ALIVE signal on the connection
worker.ajp13.socket_keepalive=1
# worker "ajp13" want ajp13 connection to be dropped after 5mn (recycle)
worker.ajp13.recycle_timeout=300
# Define the LB worker
worker.router.type=lb
worker.router.balance_workers=ajp13
# Add the status worker to the worker list
worker.list=jkstatus
# Define a 'jkstatus' worker using status
worker.jkstatus.type=status
# Add the jkstatus mount point
JkMount /jkmanager/* jkstatus
# Enable the JK manager access from localhost only
<location>
JkMount jkstatus
Order deny,allow
Deny from all
Allow from 127.0.0.1
</location>
5、修改C:\ApacheGroup\Tomcat5.5\conf\server.xml
在<engine name="Catalina" defaulthost="localhost">后面加上:
<listener classname="org.apache.jk.config.ApacheConfig" modjk="C:/ApacheGroup/Apache2/modules/mod_jk.so">
重起Tomcat,会发现在C:\ApacheGroup\Tomcat5.5\conf下面新建了两个目录:jk和auto,其中auto中有一个文件mod_jk.conf。
6、修改C:\ApacheGroup\Apache2\conf\httpd.conf
在最后加上:
Include C:/ApacheGroup/Tomcat5.5/conf/auto/mod_jk.conf
7、重起Apache2
8、检测http://localhost/jsp-examples,看到Tomcat的jsp-examples。