快速配置Apache1.3.22 + Tomcat4.0.3 一、准备工作 硬件:PC, 64M以上内存
软件环境:Win2000 + JDK1.4
相关软件:请到http://www.apache.org/下载Apache1.3.22 、Tomcat4.0.3、mod_jk.dll
二、一个实例 我需要建立一个项目,名叫annai,Apache和Tomcat安装在D盘,以下是我的安装步骤。 第一步:安装JDK1.4、Apache、Tomcat JDK1.4默认安装在C:\j2sdk1.4.0。
Apache安装在D:\apache,Tomcat安装在D:\tomcat,这里最好不要用默认的路径,
另外在安装Apache时,其中有一步我选择的是只给自己使用,即选第二项。 第二步: 在D:\tomcat\conf下新建目录jk,在jk目录下新建两个文件mod_jk.conf、workers.properties(这两个文件的内容参见附录)。
在D:\tomcat\webapps下建立目录annai,并在该目录下新建文件index.jsp,在index.jsp文件中写入语句。
修改D:\tomcat\conf下server.xml文件,注释掉所有的Context内的内容,在此位置加入语句 OK,至此,Tomcat配置完毕!接下修改Apache。 将mod_jk.dll拷贝到D:\Apache\Apache\modules下,打开D:\Apache\Apache\conf下httpd.conf文件,在最后加入语句
Include d:/Tomcat/conf/jk/mod_jk.conf
接下来找到DocumentRoot,此行改为
DocumentRoot "D:/Tomcat/webapps/annai"
再找到项,此行改为 再找到DirectoryIndex,此行改为
DirectoryIndex index.html index.jsp
OK,Apache也配完了!
三、启动 进入D:\tomcat\bin,双击startup.bat,启动Tomcat,提示
Starting service Tomcat-Standalone
Apache Tomcat/4.0.3
Starting service Tomcat-Apache
Apache Tomcat/4.0.3
说明Tomcat启动成功。 进入D:\Apache\Apache,双击Apache.exe,提示
Apache/1.3.22 (Win32) mod_jk/1.1.0 running
说明Apache启动成功。 打开网页,在地址栏输入localhost,将输出
Hello! 一切OK,祝你成功!
附录:
mod_jk.conf 文件内容
#
# The following line instructs Apache to load the jk module
#
LoadModule jk_module modules/mod_jk.dll JkWorkersFile "d:/tomcat/conf/jk/workers.properties"
JkLogFile "d:/tomcat/logs/mod_jk.log" #
# Log level to be used by mod_jk
#
JkLogLevel error #
# Root context mounts for Tomcat
#
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13 #########################################################
# Auto configuration for the /annai context starts.
######################################################### #
# The following line makes apache aware of the location of the /annai context
#
Alias /annai "d:/Tomcat/webapps/annai" Options Indexes FollowSymLinks
#
# The following line mounts all JSP files and the /servlet/ uri to tomcat
#
JkMount /annai/servlet/* ajp13
JkMount /annai/*.jsp ajp13 #
# The following line prohibits users from directly accessing WEB-INF
# AllowOverride None
deny from all #
# Use Directory too. On Windows, Location doesn't work unless case matches
# AllowOverride None
deny from all
#
# The following line prohibits users from directly accessing META-INF
# AllowOverride None
deny from all #
# Use Directory too. On Windows, Location doesn't work unless case matches
# AllowOverride None
deny from all
#######################################################
# Auto configuration for the /annai context ends.
#######################################################
workers.properties文件内容
#
# 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=d:\tomcat #
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=C:\j2sdk1.4.0 #
# 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=ajp13 #
#------ 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=ajp13
给个例子你看吧*-*
软件环境:Win2000 + JDK1.4
相关软件:请到http://www.apache.org/下载Apache1.3.22 、Tomcat4.0.3、mod_jk.dll
二、一个实例 我需要建立一个项目,名叫annai,Apache和Tomcat安装在D盘,以下是我的安装步骤。 第一步:安装JDK1.4、Apache、Tomcat JDK1.4默认安装在C:\j2sdk1.4.0。
Apache安装在D:\apache,Tomcat安装在D:\tomcat,这里最好不要用默认的路径,
另外在安装Apache时,其中有一步我选择的是只给自己使用,即选第二项。 第二步: 在D:\tomcat\conf下新建目录jk,在jk目录下新建两个文件mod_jk.conf、workers.properties(这两个文件的内容参见附录)。
在D:\tomcat\webapps下建立目录annai,并在该目录下新建文件index.jsp,在index.jsp文件中写入语句。
修改D:\tomcat\conf下server.xml文件,注释掉所有的Context内的内容,在此位置加入语句 OK,至此,Tomcat配置完毕!接下修改Apache。 将mod_jk.dll拷贝到D:\Apache\Apache\modules下,打开D:\Apache\Apache\conf下httpd.conf文件,在最后加入语句
Include d:/Tomcat/conf/jk/mod_jk.conf
接下来找到DocumentRoot,此行改为
DocumentRoot "D:/Tomcat/webapps/annai"
再找到项,此行改为 再找到DirectoryIndex,此行改为
DirectoryIndex index.html index.jsp
OK,Apache也配完了!
三、启动 进入D:\tomcat\bin,双击startup.bat,启动Tomcat,提示
Starting service Tomcat-Standalone
Apache Tomcat/4.0.3
Starting service Tomcat-Apache
Apache Tomcat/4.0.3
说明Tomcat启动成功。 进入D:\Apache\Apache,双击Apache.exe,提示
Apache/1.3.22 (Win32) mod_jk/1.1.0 running
说明Apache启动成功。 打开网页,在地址栏输入localhost,将输出
Hello! 一切OK,祝你成功!
附录:
mod_jk.conf 文件内容
#
# The following line instructs Apache to load the jk module
#
LoadModule jk_module modules/mod_jk.dll JkWorkersFile "d:/tomcat/conf/jk/workers.properties"
JkLogFile "d:/tomcat/logs/mod_jk.log" #
# Log level to be used by mod_jk
#
JkLogLevel error #
# Root context mounts for Tomcat
#
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13 #########################################################
# Auto configuration for the /annai context starts.
######################################################### #
# The following line makes apache aware of the location of the /annai context
#
Alias /annai "d:/Tomcat/webapps/annai" Options Indexes FollowSymLinks
#
# The following line mounts all JSP files and the /servlet/ uri to tomcat
#
JkMount /annai/servlet/* ajp13
JkMount /annai/*.jsp ajp13 #
# The following line prohibits users from directly accessing WEB-INF
# AllowOverride None
deny from all #
# Use Directory too. On Windows, Location doesn't work unless case matches
# AllowOverride None
deny from all
#
# The following line prohibits users from directly accessing META-INF
# AllowOverride None
deny from all #
# Use Directory too. On Windows, Location doesn't work unless case matches
# AllowOverride None
deny from all
#######################################################
# Auto configuration for the /annai context ends.
#######################################################
workers.properties文件内容
#
# 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=d:\tomcat #
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=C:\j2sdk1.4.0 #
# 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=ajp13 #
#------ 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=ajp13
给个例子你看吧*-*
不过从你报的错误来看是,socket连接的错误,
这方面的错误一般是,由你的服务引起的,
所以你说的和你内存方面的原因,也是可能的,也许是你的tomcat + apache之间的协调节有一些问题,具体的,你可以把你的代码拿来上来分析一下。
不知道那有比较稳定的apache 版本和 mod_jk下
http://www.apache.org/
如果是SQLSERVER驱动,是“connection reset by peer,socket write error”
前几小时正常,使用几小时后,才会出现这种问题