| 订阅 | 在线投稿
分享
 
 
 

WIN2000+PHP+MYSQL+TOMCAT+JSP完全整合安装手册

来源:互联网网民  宽屏版  评论
2006-12-17 08:43:39

WIN2000+PHP+MYSQL+TOMCAT+JSP完全整合安装手册

WIN2000+PHP+MYSQL+TOMCAT+JSP完全整合安装手册

一、前期准备情况

1。一个安装好的WIN2000服务器,注意:如果预装了IIS,请先将IIS服务停掉或禁用。

2。下栽软件

APACHE:版本:1.3.22 地址:http://www.5line.net/web_soft/apache_1.3.22-win32-x86.msi

JDK:版本: 1.3 地址:http://www.5line.net/web_soft/j2sdk1_3_0-win.exe

PHP: 版本: 4.0.4 地址:http://www.5line.net/web_soft/php4.0.4pl1-win32.zip

MYSQL: 版本:3.23.32 地址:http://www.5line.net/web_soft/mysql-3.23.32-win.zip

TOMCAT:版本: 4.0.4 地址: http://www.5line.net/web_soft/jakarta-tomcat-4.0.4.exe

Mod_jk:这是Jakarta组织开发的使Apache支持Tomcat的插件,比ApacheJserv更强大,因为ApacheJserv

只能用在Apache上,而不能用在别的WebServer 上,Mod_jk可以和很多服务器搭配起来用。

下载地址:http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.3/bin/win32/i386/

(如果在提供的网址内找不到相应的软件,请在各大网上软件库找,一般都有!或发邮件至info@5line.net)

3。准备好足够的干粮和水,作好反复安装和重新启动的心理准备,但只要细心按照要求去做,一次成功不是什么

难事!

4。做一口深呼吸,别在想MM了!开始安装!

二、安装开始

1。APACHE安装

第一步:运行apache_1.3.22-win32-x86.msi,一路点确定和接受就行,基本比较傻瓜,为了方便期间和符合我

的习惯我安装的默认路径是 c:\ ,这样就安装在C盘下的APACHE的路径下,同时默认域为root.dev。

第二步:(我在这里作了一个虚拟主机,此步可以不做,根据你自己的需求)

编辑c:\apache\conf\httpd.conf

找到 #NameVirtualHost *

修改为 NameVirtualHost 192.168.0.16 #注意这个IP为你自己主机设的IP

找到 ServerName root.dev

修改为 #ServerName root.dev

添加

<VirtualHost 192.168.0.16>

ServerAdmin root@localhost

ServerName root.dev

DocumentRoot c:/apache/htdocs

ErrorLog c:/apache/logs/error_log

TransferLog c:/apache/logs/access_log

ScriptAlias /cgi-bin c:/apache/cgi-bin

</VirtualHost>

第三步:将文件名 c:\apache\htdocs\index.html.en 改为c:\apache\htdocs\index.html

第四步:重新启动,访问 http://root.dev 浏览正常,显示APACHE欢迎页

------------小小的成功!可以喝口水了!----------------------------

2。MYSQL安装

第一步: 解压 mysql-3.23.32-win.zip 到目录 D:\MYSQL

第二步: 进入D:\MYSQL 运行SETUP.EXE 一路回车,默认安装到 C:\MYSQL

------------这一步应该没有什么问题!-------------------------------

3。PHP安装

第一步: 解压 php4.0.4pl1-win32.zip 到目录 D:\PHP

第二步: 将D:\PHP下拷贝到C盘根目录下

第三步: 进入C:\PHP ,开始配置PHP

将文件名 php.ini-dist 改为 php.ini

同时拷贝 php.ini 和 php4ts.dll 到WIN2000的系统安装目录下

的 system32和system目录下 (很重要,别忘了)

再次修改APACHE的配置文件httpd.conf (忘了吧!在c:\apache\conf\httpd.conf)

添加:

LoadModule php4_module c:/php/sapi/php4apache.dll

AddType application/x-httpd-php .php4

ScriptAlias /php4/ "C:/php/"

Action application/x-httpd-php4 "/php4/php.exe"

AddType application/x-httpd-php4 .php

第四步: 重新启动系统

第五步: 测试

编写测试文件 info.php (拷贝到目录 c:\apache\htdocs\ 下)

文件内容:(就一行)

<? phpinfo(); ?>

访问: http://localhost/info.php 或 http://root.dev/info.php

如果看到PHP的欢迎测试页面,说明安装成功!

到目前为止,你的系统已经可以运行PHP程序了!

你已经配置好了 win2000+apache+php+mysql

----------------成功在望!吃些干粮,想5分钟MM,上趟厕所,或者骚扰一下隔壁的大哥---------

---如果你能确定2件事就可以往下进行了:

1.你的智商确实比中国足协的那堆废物高

2.真的很想进入JSP的世界遨游

4。JDK的安装

第一步:直接运行 j2sdk1_3_0-win.exe,一路回车安装,我这里默认的安装路径为d:\jdk1.3

第二步:配置环境变量

在我的电脑上点击鼠标右键-属性-点选高级-点选环境变量

弹出环境变量对话框,新建以下变量名和值:

-------------------------------------

变量名:path

变量值:d:\jdk1.3\bin

变量名:JAVA_HOME

变量值:d:\jdk1.3

变量名:CLASSPATH

变量值:.\;d:\jdk1.3\lib\dt.jar;d:\jdk1.3\lib\tools.jar;

第三步:重新启动计算机使配置的环境变量生效

5。TOMCAT安装

第一步:直接运行安装jakarta-tomcat-4.0.4.exe,我这里默认的安装路径是c:\Apache Tomcat 4.0

这时如果单独启动TOMCAT(到Tomca目录下运行startup.bat启动Tomcat或在菜单栏运行start

tomcat),就已经可以运行JSP文件了,但是我们还没有将APACHE和TOMCAT集成在一起,因为

虽然TOMCAT有内置的一个APACHE的HTTP服务,但是他仅仅对JSP程序体现出比较好的执行效率

和性能,对于静态页面的处理速度远不如APACHE,所以为了一个完美的WEB系统,我们要将

APACHE和TOMCAT集成在一起!

(下面就是集成他们的具体配置步骤,请注意仔细认真,我搞了1天才终于搞定!)

第二步:先配置APACHE

打开c:\apache\conf\httpd.conf

添加以下语句:

#------------------------------------------

LoadModule jk_module libexec/mod_jk.dll

AddModule mod_jk.c

JkWorkersFile "c:\Apache Tomcat 4.0\conf\worker.properties"

JkLogFile logs/mod_jk.log

JkLogLevel info

JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

JkMount /*.jsp ajp13

JkMount /servlet/* ajp13

#-----------------------------------------------------

注意:以上语句的基本意思是:

第一、二句:指定APACHE和TOMCAT连接插件的位置和名称

第三句:指出mod_jk工作所需要的工作文件的位置

第七、八句:是将所有和jsp和servlet的请求通过Apj13的协议送给Tomcat,让Tomcat来处理

第三步:将下载的mod_jk.dllcopy到安装Apache目录下的libexec下就可以了

第四步:TOMCAT配置

首先是在c:\Apache Tomcat4.0\conf目录下建一个worker.properties

文件内容如下:

#----------------------------------------------------------

# $Header: /home/cvs/jakarta-tomcat/src/etc/Attic/workers.properties,v 1.3.2.2 2000/10/16 01:59:22 larryi Exp $

# $Revision: 1.3.2.2 $

# $Date: 2000/10/16 01:59:22 $

#

#

# workers.properties -

#

# This file provides jk derived plugins with with the needed information to

# connect to the different tomcat workers.

#

# As a general note, the characters $( and ) are used internally to define

# macros. Do not use them in your own configuration!!!

#

# Whenever you see a set of lines such as:

# x=value

# y=$(x)something

#

# the final value for y will be valuesomething

#

# Normaly all you will need to modify is the first properties, i.e.

# workers.tomcat_home, workers.java_home and ps. Most of the configuration

# is derived from these.

#

# When you are done updating workers.tomcat_home, workers.java_home and ps

# you should have 3 workers configured:

#

# - An ajp12 worker that connects to localhost:8007

# - An ajp13 worker that connects to localhost:8009

# - A jni inprocess worker.

# - A load balancer worker

#

# However by default the plugins will only use the ajp12 worker. To have

# the plugins use other workers you should modify the worker.list property.

#

#

#

# workers.tomcat_home should point to the location where you

# installed tomcat. This is where you have your conf, webapps and lib

# directories.

#

workers.tomcat_home=c:\Apache Tomcat 4.0

#

# workers.java_home should point to your Java installation. Normally

# you should have a bin and lib directories beneath it.

#

workers.java_home=d:\jdk1.3

#

# You should configure your environment slash... ps= on NT and / on UNIX

# and maybe something different elsewhere.

#

ps=\

# ps=/

#

#------ ADVANCED MODE ------------------------------------------------

#---------------------------------------------------------------------

#

#

#------ DEFAULT worket list ------------------------------------------

#---------------------------------------------------------------------

#

#

# The workers that your plugins should create and work with

#

worker.list=ajp12, ajp13

#

#------ DEFAULT ajp12 WORKER DEFINITION ------------------------------

#---------------------------------------------------------------------

#

#

# Defining a worker named ajp12 and of type ajp12

# Note that the name and the type do not have to match.

#

worker.ajp12.port=8007

worker.ajp12.host=localhost

worker.ajp12.type=ajp12

#

# 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.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.0\conf\server.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.0\webapps\ROOT下,然后在浏览器里输入

http://localhost/hello.jsp如果看到了Hello,那么您的确成功了。

------------------至此你已经大功告成,可以哼一个小曲了--------------------------

我的这个配置文档是经过考验,确实可以正常通过并运行的,希望能给你有所帮助,如果在进

行过程中有任何问题,请通知我!

我的QQ:5359496,11035181 EMAIL:info@5line.net

其次我再阐述两个问题:

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:\apache\htdocs\下,而在

C:\Apache Tomcat 4.0\webapps\ROOT 下。这点请注意,不要混淆概念!

 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
WIN2000+PHP+MYSQL+TOMCAT+JSP完全整合安装手册 WIN2000+PHP+MYSQL+TOMCAT+JSP完全整合安装手册 一、前期准备情况 1。一个安装好的WIN2000服务器,注意:如果预装了IIS,请先将IIS服务停掉或禁用。 2。下栽软件 APACHE:版本:1.3.22 地址:http://www.5line.net/web_soft/apache_1.3.22-win32-x86.msi JDK:版本: 1.3 地址:http://www.5line.net/web_soft/j2sdk1_3_0-win.exe PHP: 版本: 4.0.4 地址:http://www.5line.net/web_soft/php4.0.4pl1-win32.zip MYSQL: 版本:3.23.32 地址:http://www.5line.net/web_soft/mysql-3.23.32-win.zip TOMCAT:版本: 4.0.4 地址: http://www.5line.net/web_soft/jakarta-tomcat-4.0.4.exe Mod_jk:这是Jakarta组织开发的使Apache支持Tomcat的插件,比ApacheJserv更强大,因为ApacheJserv 只能用在Apache上,而不能用在别的WebServer 上,Mod_jk可以和很多服务器搭配起来用。 下载地址:http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.3/bin/win32/i386/ (如果在提供的网址内找不到相应的软件,请在各大网上软件库找,一般都有!或发邮件至info@5line.net) 3。准备好足够的干粮和水,作好反复安装和重新启动的心理准备,但只要细心按照要求去做,一次成功不是什么 难事! 4。做一口深呼吸,别在想MM了!开始安装! 二、安装开始 1。APACHE安装 第一步:运行apache_1.3.22-win32-x86.msi,一路点确定和接受就行,基本比较傻瓜,为了方便期间和符合我 的习惯我安装的默认路径是 c:\ ,这样就安装在C盘下的APACHE的路径下,同时默认域为root.dev。 第二步:(我在这里作了一个虚拟主机,此步可以不做,根据你自己的需求) 编辑c:\apache\conf\httpd.conf 找到 #NameVirtualHost * 修改为 NameVirtualHost 192.168.0.16 #注意这个IP为你自己主机设的IP 找到 ServerName root.dev 修改为 #ServerName root.dev 添加 <VirtualHost 192.168.0.16> ServerAdmin root@localhost ServerName root.dev DocumentRoot c:/apache/htdocs ErrorLog c:/apache/logs/error_log TransferLog c:/apache/logs/access_log ScriptAlias /cgi-bin c:/apache/cgi-bin </VirtualHost> 第三步:将文件名 c:\apache\htdocs\index.html.en 改为c:\apache\htdocs\index.html 第四步:重新启动,访问 http://root.dev 浏览正常,显示APACHE欢迎页 ------------小小的成功!可以喝口水了!---------------------------- 2。MYSQL安装 第一步: 解压 mysql-3.23.32-win.zip 到目录 D:\MYSQL 第二步: 进入D:\MYSQL 运行SETUP.EXE 一路回车,默认安装到 C:\MYSQL ------------这一步应该没有什么问题!------------------------------- 3。PHP安装 第一步: 解压 php4.0.4pl1-win32.zip 到目录 D:\PHP 第二步: 将D:\PHP下拷贝到C盘根目录下 第三步: 进入C:\PHP ,开始配置PHP 将文件名 php.ini-dist 改为 php.ini 同时拷贝 php.ini 和 php4ts.dll 到WIN2000的系统安装目录下 的 system32和system目录下 (很重要,别忘了) 再次修改APACHE的配置文件httpd.conf (忘了吧!在c:\apache\conf\httpd.conf) 添加: LoadModule php4_module c:/php/sapi/php4apache.dll AddType application/x-httpd-php .php4 ScriptAlias /php4/ "C:/php/" Action application/x-httpd-php4 "/php4/php.exe" AddType application/x-httpd-php4 .php 第四步: 重新启动系统 第五步: 测试 编写测试文件 info.php (拷贝到目录 c:\apache\htdocs\ 下) 文件内容:(就一行) <? phpinfo(); ?> 访问: http://localhost/info.php 或 http://root.dev/info.php 如果看到PHP的欢迎测试页面,说明安装成功! 到目前为止,你的系统已经可以运行PHP程序了! 你已经配置好了 win2000+apache+php+mysql ----------------成功在望!吃些干粮,想5分钟MM,上趟厕所,或者骚扰一下隔壁的大哥--------- ---如果你能确定2件事就可以往下进行了: 1.你的智商确实比中国足协的那堆废物高 2.真的很想进入JSP的世界遨游 4。JDK的安装 第一步:直接运行 j2sdk1_3_0-win.exe,一路回车安装,我这里默认的安装路径为d:\jdk1.3 第二步:配置环境变量 在我的电脑上点击鼠标右键-属性-点选高级-点选环境变量 弹出环境变量对话框,新建以下变量名和值: ------------------------------------- 变量名:path 变量值:d:\jdk1.3\bin 变量名:JAVA_HOME 变量值:d:\jdk1.3 变量名:CLASSPATH 变量值:.\;d:\jdk1.3\lib\dt.jar;d:\jdk1.3\lib\tools.jar; 第三步:重新启动计算机使配置的环境变量生效 5。TOMCAT安装 第一步:直接运行安装jakarta-tomcat-4.0.4.exe,我这里默认的安装路径是c:\Apache Tomcat 4.0 这时如果单独启动TOMCAT(到Tomca目录下运行startup.bat启动Tomcat或在菜单栏运行start tomcat),就已经可以运行JSP文件了,但是我们还没有将APACHE和TOMCAT集成在一起,因为 虽然TOMCAT有内置的一个APACHE的HTTP服务,但是他仅仅对JSP程序体现出比较好的执行效率 和性能,对于静态页面的处理速度远不如APACHE,所以为了一个完美的WEB系统,我们要将 APACHE和TOMCAT集成在一起! (下面就是集成他们的具体配置步骤,请注意仔细认真,我搞了1天才终于搞定!) 第二步:先配置APACHE 打开c:\apache\conf\httpd.conf 添加以下语句: #------------------------------------------ LoadModule jk_module libexec/mod_jk.dll AddModule mod_jk.c JkWorkersFile "c:\Apache Tomcat 4.0\conf\worker.properties" JkLogFile logs/mod_jk.log JkLogLevel info JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " JkMount /*.jsp ajp13 JkMount /servlet/* ajp13 #----------------------------------------------------- 注意:以上语句的基本意思是: 第一、二句:指定APACHE和TOMCAT连接插件的位置和名称 第三句:指出mod_jk工作所需要的工作文件的位置 第七、八句:是将所有和jsp和servlet的请求通过Apj13的协议送给Tomcat,让Tomcat来处理 第三步:将下载的mod_jk.dllcopy到安装Apache目录下的libexec下就可以了 第四步:TOMCAT配置 首先是在c:\Apache Tomcat4.0\conf目录下建一个worker.properties 文件内容如下: #---------------------------------------------------------- # $Header: /home/cvs/jakarta-tomcat/src/etc/Attic/workers.properties,v 1.3.2.2 2000/10/16 01:59:22 larryi Exp $ # $Revision: 1.3.2.2 $ # $Date: 2000/10/16 01:59:22 $ # # # workers.properties - # # This file provides jk derived plugins with with the needed information to # connect to the different tomcat workers. # # As a general note, the characters $( and ) are used internally to define # macros. Do not use them in your own configuration!!! # # Whenever you see a set of lines such as: # x=value # y=$(x)something # # the final value for y will be valuesomething # # Normaly all you will need to modify is the first properties, i.e. # workers.tomcat_home, workers.java_home and ps. Most of the configuration # is derived from these. # # When you are done updating workers.tomcat_home, workers.java_home and ps # you should have 3 workers configured: # # - An ajp12 worker that connects to localhost:8007 # - An ajp13 worker that connects to localhost:8009 # - A jni inprocess worker. # - A load balancer worker # # However by default the plugins will only use the ajp12 worker. To have # the plugins use other workers you should modify the worker.list property. # # # # workers.tomcat_home should point to the location where you # installed tomcat. This is where you have your conf, webapps and lib # directories. # workers.tomcat_home=c:\Apache Tomcat 4.0 # # workers.java_home should point to your Java installation. Normally # you should have a bin and lib directories beneath it. # workers.java_home=d:\jdk1.3 # # You should configure your environment slash... ps= on NT and / on UNIX # and maybe something different elsewhere. # ps=\ # ps=/ # #------ ADVANCED MODE ------------------------------------------------ #--------------------------------------------------------------------- # # #------ DEFAULT worket list ------------------------------------------ #--------------------------------------------------------------------- # # # The workers that your plugins should create and work with # worker.list=ajp12, ajp13 # #------ DEFAULT ajp12 WORKER DEFINITION ------------------------------ #--------------------------------------------------------------------- # # # Defining a worker named ajp12 and of type ajp12 # Note that the name and the type do not have to match. # worker.ajp12.port=8007 worker.ajp12.host=localhost worker.ajp12.type=ajp12 # # 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.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.0\conf\server.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.0\webapps\ROOT下,然后在浏览器里输入 http://localhost/hello.jsp如果看到了Hello,那么您的确成功了。 ------------------至此你已经大功告成,可以哼一个小曲了-------------------------- 我的这个配置文档是经过考验,确实可以正常通过并运行的,希望能给你有所帮助,如果在进 行过程中有任何问题,请通知我! 我的QQ:5359496,11035181 EMAIL:info@5line.net 其次我再阐述两个问题: 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:\apache\htdocs\下,而在 C:\Apache Tomcat 4.0\webapps\ROOT 下。这点请注意,不要混淆概念!
󰈣󰈤
 
 
 
>>返回首页<<
 
 热帖排行
 
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
©2005- 王朝网络 版权所有