a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.ajp12.lbfactor=1
#
#------ DEFAULT ajp13 WORKER DEFINITION ------------------------------
#---------------------------------------------------------------------
#
#
# Defining a worker named ajp13 and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.ajp13.lbfactor=1
#
# Specify the size of the open connection cache.
#worker.ajp13.cachesize
#
#------ DEFAULT LOAD BALANCER WORKER DEFINITION ----------------------
#---------------------------------------------------------------------
#
#
# The loadbalancer (type lb) workers perform wighted round-robin
# load balancing with sticky sessions.
# Note:
# ----> If a worker dies, the load balancer will check its state
# once in a while. Until then all work is redirected to peer
# workers.
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp12, ajp13
#
#------ DEFAULT JNI WORKER DEFINITION---------------------------------
#---------------------------------------------------------------------
#
#
# Defining a worker named inprocess and of type jni
# Note that the name and the type do not have to match.
#
worker.inprocess.type=jni
#
#------ CLASSPATH DEFINITION -----------------------------------------
#---------------------------------------------------------------------
#
#
# Additional class path components.
#
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)classes
#
# The XML parser provided with Tomcat
#
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)jaxp.jar
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)parser.jar
#
# Tomcat`s implementation
#
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
#
# Javac as available from Java2SE
#
worker.inprocess.class_path=$(workers.java_home)$(ps)lib$(ps)tools.jar
#
# Setting the command line for tomcat
# Note: The cmd_line string may not contain spaces.
#
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)
#
# The JVM that we are about to use
#
# This is for Java2
#
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)jvm.dll
#
# And this is for jdk1.1.X
#
#worker.inprocess.jvm_lib=$(workers.java_home)$(ps)bin$(ps)javai.dll
#
#
# Setting the place for the stdout and stderr of tomcat
#
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)inprocess.stderr
#
# Setting the tomcat.home Java property
#
worker.inprocess.sysprops=tomcat.home=$(workers.tomcat_home)
#
# Java system properties
#
# worker.inprocess.sysprops=java.compiler=NONE
# worker.inprocess.sysprops=myprop=mypropvalue
#
# Additional path components.
#
# worker.inprocess.ld_path=d:$(ps)SQLLIB$(ps)bin
#
#--------------------------------------配置文件完毕-------------------------------------
在这个文件中需要注意的是要修改只有两个地方,一个是workers.tomcat_home,
这是指定Tomcat工作的目录,另外一个是workers.java_home,这是指定Jdk的目
录,大家可以做适当修改!我这里的配置没有修改,都是符合我安装系统的配置!
其次,配置TOMCAT核心文件,打开 c:Apache Tomcat4.0confserver.xml
修改如下:
将<!-- Define an AJP 1.3 Connector on port 8009 -->
<!--
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
port="8009" minProcessors="5" maxProcessors="75"
acceptCount="10" debug="0"/>
-->
的<!-- --> 去掉,这句话熟悉XML的人都知道它是注释,因为默认的Tomcat4
是没有启用Apj13的8009的端口即mod_jk所使用,修改后如下:
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
port="8009" minProcessors="5" maxProcessors="75"
acceptCount="10" debug="0"/>
然后保存,现在你的Tomcat和Apache的配置基本完成了。
第五步:所有配置基本完成,重新启动计算机,开始整体测试!
测试:大家首先启动Apache,然后在浏览器里输入http://localhost,如果能看
到Apache的欢迎页面,那么恭喜您,第一步成功了。然后回到Tomca目录下
运行startup.bat启动Tomcat,再打开浏览器输入:http://localhost:8080/
如果看到可爱的Tomcat,那么恭喜您,Tomcat也没有问题,最后最重要的是
Apache下可以解释jsp和Servlet,把下面的代码copy到文本编辑器中命名为
hello.jsp,
内容如下:
<%@ page contentType="text/html;charset=gb2312"%>
<html>
<body>
<%String str="Hello World!";%>
<%str=str+"你好";%>
<%=str%>
</body>
</html>
将它保存到C:Apache Tomcat 4.0webappsROOT下,然后在浏览器里输入
http://localhost/hello.jsp如果看到了Hello,那么您的确成功了。
------------------至此你已经大功告成,可以哼一个小曲了--------------------------
我的这个配置文档是经过考验,确实可以正常通过并运行的,希望能给你有所帮助,如果在进
行过程中有任何问题,请通知我!
我的QQ:5359496
EMAIL:apollo@risesun-cn.com
其次我再阐述两个问题:
1。由于我在配置APACHE中使用了虚拟主机,所以访问地址可以是:
http://localhost和http://root.dev,但是如果想http://root.dev访问成功的话,请在
浏览器里做如下设置:
INTERNET选项-连接-局域网设置
选择 “使用代理服务器”,地址:192.168.0.16 (写你主机的IP) 端口:80
2。对于APACHE主机下访问的JSP文件,实际上物理上不存在与APACHE的主机上,而是存在在
TOMCAT的主机目录里,例如:
http://localhost/hello.jsp 中hello.jsp文件实际不在 c:apachehtdocs下,而在
C:Apache Tomcat 4.0webappsROOT 下。这点请注意,不要混淆概念!
上一页 [1] [2]