首先就是软件下载的准备了,假设你的jdk已经安装了,我的版本是1.4
1、Apache Server 我的版本是2.0.50
2、tomcat 版本是 4.1.30
3、mod_jk.dll 版本是 mod_jk_1.2.6_2.0.50.dll 下载地址:http://apache.linuxforum.net/dist/jakarta/tomcat-connectors/jk/binaries/win32/
注意:这里的mod_jk.dll一定要下载2.0的,应为我们应用的Apache Server是2.0版本的,请大家不要下错了。
安装过程:
一、安装配置Apache HTTP
首先要确认你机器上的80端口没有被占用,如果有IIS web服务请先停掉(这个大家一般都知道,我就不在这里讲述了),然后安装Apache HTTP,在安装过程中,有一步骤是填写NetWork Domain和Server Name,这两项都填写localhost,email填写你自己的ok,
我的安装路径是C:\ApacheGroup,注意中间没有空格,这一步很关键,请大家留意,其它步骤请按默认设置执行。
安装完毕后,在浏览器中访问 http://localhost
你应该看到apache的欢迎页面,表示apache server安装成功。
二、安装tomcat
按默认的步骤安装,我的安装路径是D:\Tomcat 4.1,安装之后访问 http://localhost:8080,应该可以看到tomcat的welcome page.
三、安装connectors
把文件mod_jk_1.2.6_2.0.50.dll拷贝到 C:\ApacheGroup\Apache2\modules\,并更名为mod_jk.dll。
配置过程:
1、找到D:\Tomcat 4.1\conf下面的server.xml,打开后,找到<Server port="8005" shutdown="SHUTDOWN" debug="0">,在她的下面添加
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" modJk="C:/ApacheGroup/Apache2/modules/mod_jk.dll" />
往下面继续寻找 <Host ...>,在她的后面添加
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" append="true" forwardAll="false" modJk="C:/ApacheGroup/Apache2/modules/mod_jk.dll" />
2、打开C:\ApacheGroup\Apache2\conf下面的httpd.conf,在文件的末尾添加
Include "D:/Tomcat 4.1/conf/auto/mod_jk.conf"
3、在D:\Tomcat 4.1\conf目录下面新建两个目录auto和jk。
打开目录auto,新建一个文件mod_jk.conf,文件的内容如下:
########## Auto generated on Fri Aug 06 14:30:33 CST 2004##########
<IfModule !mod_jk.c>
LoadModule jk_module C:/ApacheGroup/Apache2/modules/mod_jk.dll
</IfModule>
JkWorkersFile "d:/Tomcat 4.1/conf/jk/workers.properties"
JkLogFile "d:/Tomcat 4.1/logs/mod_jk.log"
JkLogLevel emerg
<VirtualHost localhost>
ServerName localhost
#################### localhost:/cabin ####################
# Static files
Alias /cabin "D:/Tomcat 4.1/webapps/cabin"
<Directory "D:/Tomcat 4.1/webapps/cabin">
Options Indexes FollowSymLinks
DirectoryIndex index.jsp
</Directory>
# Deny direct access to WEB-INF and META-INF
#
<Location "/cabin/WEB-INF/*">
AllowOverride None
deny from all
</Location>
<Location "/cabin/META-INF/*">
AllowOverride None
deny from all
</Location>
#
# Use Directory too. On Windows, Location doesn't work unless case matches
#
<Directory "D:/Tomcat 4.1/webapps/cabin/WEB-INF/">
AllowOverride None
deny from all
</Directory>
<Directory "D:/Tomcat 4.1/webapps/cabin/META-INF/">
AllowOverride None
deny from all
</Directory>
JkMount /cabin/*.jsp ajp13
#################### localhost:/admin ####################
# Static files
Alias /admin "D:/Tomcat 4.1/webapps/../server/webapps/admin"
<Directory "D:/Tomcat 4.1/webapps/../server/webapps/admin">
Options Indexes FollowSymLinks
DirectoryIndex index.html index.htm index.jsp
</Directory>
# Deny direct access to WEB-INF and META-INF
#
<Location "/admin/WEB-INF/*">
AllowOverride None
deny from all
</Location>
<Location "/admin/META-INF/*">
AllowOverride None
deny from all
</Location>
#
# Use Directory too. On Windows, Location doesn't work unless case matches
#
<Directory "D:/Tomcat 4.1/webapps/../server/webapps/admin/WEB-INF/">
AllowOverride None
deny from all
</Directory>
<Directory "D:/Tomcat 4.1/webapps/../server/webapps/admin/META-INF/">
AllowOverride None
deny from all
</Directory>
JkMount /admin/j_security_check ajp13
JkMount /admin/*.do ajp13
JkMount /admin/*.jsp ajp13
#################### localhost:/Hi ####################
# Static files
Alias /Hi "D:/Tomcat 4.1/webapps/Hi"
<Directory "D:/Tomcat 4.1/webapps/Hi">
Options Indexes FollowSymLinks
DirectoryIndex index.jsp
</Directory>
# Deny direct access to WEB-INF and META-INF
#
<Location "/Hi/WEB-INF/*">
AllowOverride None
deny from all
</Location>
<Location "/Hi/META-INF/*">
AllowOverride None
deny from all
</Location>
#
# Use Directory too. On Windows, Location doesn't work unless case matches
#
<Directory "D:/Tomcat 4.1/webapps/Hi/WEB-INF/">
AllowOverride None
deny from all
</Directory>
<Directory "D:/Tomcat 4.1/webapps/Hi/META-INF/">
AllowOverride None
deny from all
</Directory>
JkMount /Hi/*.jsp ajp13
#################### localhost:/webdav ####################
# Static files
Alias /webdav "D:/Tomcat 4.1/webapps/webdav"
<Directory "D:/Tomcat 4.1/webapps/webdav">
Options Indexes FollowSymLinks
DirectoryIndex index.jsp index.html index.htm
</Directory>
# Deny direct access to WEB-INF and META-INF
#
<Location "/webdav/WEB-INF/*">
AllowOverride None
deny from all
</Location>
<Location "/webdav/META-INF/*">
AllowOverride None
deny from all
</Location>
#
# Use Directory too. On Windows, Location doesn't work unless case matches
#
<Directory "D:/Tomcat 4.1/webapps/webdav/WEB-INF/">
AllowOverride None
deny from all
</Directory>
<Directory "D:/Tomcat 4.1/webapps/webdav/META-INF/">
AllowOverride None
deny from all
</Directory>
JkMount /webdav/*.jsp ajp13
#################### localhost:/examples ####################
# Static files
Alias /examples "D:/Tomcat 4.1/webapps/examples"
<Directory "D:/Tomcat 4.1/webapps/examples">
Options Indexes FollowSymLinks
DirectoryIndex index.html index.htm index.jsp
</Directory>
# Deny direct access to WEB-INF and META-INF
#
<Location "/examples/WEB-INF/*">
AllowOverride None
deny from all
</Location>
<Location "/examples/META-INF/*">
AllowOverride None
deny from all
</Location>
#
# Use Directory too. On Windows, Location doesn't work unless case matches
#
<Directory "D:/Tomcat 4.1/webapps/examples/WEB-INF/">
AllowOverride None
deny from all
</Directory>
<Directory "D:/Tomcat 4.1/webapps/examples/META-INF/">
AllowOverride None
deny from all
</Directory>
JkMount /examples/jsp/security/protected/j_security_check ajp13
JkMount /examples/snoop ajp13
JkMount /examples/servlet/* ajp13
JkMount /examples/CompressionTest ajp13
JkMount /examples/*.jsp ajp13
JkMount /examples/servletToJsp ajp13
JkMount /examples/SendMailServlet ajp13
#################### localhost:/Today ####################
# Static files
Alias /Today "D:/Tomcat 4.1/webapps/Today"
<Directory "D:/Tomcat 4.1/webapps/Today">
Options Indexes FollowSymLinks
DirectoryIndex index.jsp
</Directory>
# Deny direct access to WEB-INF and META-INF
#
<Location "/Today/WEB-INF/*">
AllowOverride None
deny from all
</Location>
<Location "/Today/META-INF/*">
AllowOverride None
deny from all
</Location>
#
# Use Directory too. On Windows, Location doesn't work unless case matches
#
<Directory "D:/Tomcat 4.1/webapps/Today/WEB-INF/">
AllowOverride None
deny from all
</Directory>
<Directory "D:/Tomcat 4.1/webapps/Today/META-INF/">
AllowOverride None
deny from all
</Directory>
JkMount /Today/Fuck ajp13
JkMount /Today/*.jsp ajp13
#################### localhost:/tomcat-docs ####################
# Static files
Alias /tomcat-docs "D:/Tomcat 4.1/webapps/tomcat-docs"
<Directory "D:/Tomcat 4.1/webapps/tomcat-docs">
Options Indexes FollowSymLinks
DirectoryIndex index.html index.htm index.jsp
</Directory>
# Deny direct access to WEB-INF and META-INF
#
<Location "/tomcat-docs/WEB-INF/*">
AllowOverride None
deny from all
</Location>
<Location "/tomcat-docs/META-INF/*">
AllowOverride None
deny from all
</Location>
#
# Use Directory too. On Windows, Location doesn't work unless case matches
#
<Directory "D:/Tomcat 4.1/webapps/tomcat-docs/WEB-INF/">
AllowOverride None
deny from all
</Directory>
<Directory "D:/Tomcat 4.1/webapps/tomcat-docs/META-INF/">
AllowOverride None
deny from all
</Directory>
JkMount /tomcat-docs/*.jsp ajp13
#################### localhost:/manager ####################
# Static files
Alias /manager "D:/Tomcat 4.1/webapps/../server/webapps/manager"
<Directory "D:/Tomcat 4.1/webapps/../server/webapps/manager">
Options Indexes FollowSymLinks
DirectoryIndex index.html index.htm index.jsp
</Directory>
# Deny direct access to WEB-INF and META-INF
#
<Location "/manager/WEB-INF/*">
AllowOverride None
deny from all
</Location>
<Location "/manager/META-INF/*">
AllowOverride None
deny from all
</Location>
#
# Use Directory too. On Windows, Location doesn't work unless case matches
#
<Directory "D:/Tomcat 4.1/webapps/../server/webapps/manager/WEB-INF/">
AllowOverride None
deny from all
</Directory>
<Directory "D:/Tomcat 4.1/webapps/../server/webapps/manager/META-INF/">
AllowOverride None
deny from all
</Directory>
JkMount /manager/list ajp13
JkMount /manager/deploy ajp13
JkMount /manager/html/* ajp13
JkMount /manager/resources ajp13
JkMount /manager/start ajp13
JkMount /manager/stop ajp13
JkMount /manager/install ajp13
JkMount /manager/*.jsp ajp13
JkMount /manager/remove ajp13
JkMount /manager/roles ajp13
JkMount /manager/sessions ajp13
JkMount /manager/serverinfo ajp13
JkMount /manager/reload ajp13
JkMount /manager/undeploy ajp13
</VirtualHost>
注意:上面这个文件在apache和tomcat启动后会自动更新。
打开目录jk,新建文件workers.properties,文件内容如下:
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
保存以上两个文件。
首先启动 tomcat,然后重启apache server,浏览http://localhost/examples,如果不出意外的话,你应当看到tomcat的欢迎页面,ok配置成功!
以上就是我的配置实践,如果大家有什么疑问,请浏览http://www.tryitsoft.com 在网站的留言板上留言或email至rautinee@21cn.com。
good luck!
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/
领测软件测试网最新更新
关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073