tomcat 5.0 + apache 2.0 完全安装步骤详解

 更新时间:2008年03月15日 18:44:43   作者:  
Apache httpd-2.0.47 + Tomcat jakarta-tomcat-4.1.24 + jk2 + php-4.3.3 的安装: 服务器环境: RedHat Linux 8.0 J2sdk1.4.1_02 Tomcat 4.1.12 binary Apache 2.0.47 built from source jk2 connector source from jakarta.apache.org

安装JDK:
下载: j2sdk-1_4_1_02-linux-i586.bin
把jdk 安装在/usr/local/j2sdk1.4.1_02
在/usr/local 下建立 软连接 jdk
#ln -s /usr/local/j2sdk1.4.1_02 /usr/local/jdk
[user@host]# cat /etc/profile.d/java.sh
# set java environment
export JAVA_HOME=/usr/local/jdk
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib
#更改shell文件属性:
#chmod 755 /etc/profile.d/java.sh
#查看是否正确
#which java
/usr/local/jdk/bin/java

安装apache :
#cd /usr/local/src/
#tar -xzvf httpd-2.0.47.tar.gz
#cd httpd-2.0.47
#配置apache 支持动态module 加载
#./configure
\"--with-layout=Apache\"
\"--prefix=/usr/local/apache\"
\"--enable-module=so\"
\"--enable-module=setenvif\"
\"--enable-module=rewrite\"
\"--with-mpm=prefork\"
#make
#make install
#修改http.conf 具体的修改请参考apache2.0文档
# 或者查看 
StartServers 10
MinSpareServers 25
MaxSpareServers 50
ServerLimit 2000
MaxClients 1500 #Apache可以同时处理的请求
MaxRequestsPerChild 10000

安装Php :
下载: php-4.3.3.tar.gz
#cd /usr/local/src
#tar -xzvf
#php for apache 以apache modules的方式运行
./configure --with-apxs2=/usr/local/apache/bin/apxs
#php run like shell 以单独的shell方式运行
./configure --prefix=/usr/local/php
#php for apache
./configure
--with-apxs2=/usr/local/apache/bin/apxs
--enable-track-vars
--enable-debug
--enable-url-includes
--enable-sockets
--with-config-file-path=/usr/local/apache/conf #php.ini文件放的目录
#下面的参数是安装PHP + gd库
--with-gd=/usr/local
--enable-gd-native-ttf
--with-ttf=/usr/local
--with-jpeg-dir=/usr/local
--with-zlib-dir=/usr/local
--with-png-dir=/usr/local
#make
#make install
#ls -l /usr/local/apache/modules/libphp4.so #存在 安装成功
#修改apache http.conf
添加
LoadModule php4_module modules/libphp4.so
AddType application/x-httpd-php .php

安装Tomcat:
#cd /usr/local
#tar -xzvf jakarta-tomcat-4.1.24.tar.gz
#ln -s jakarta-tomcat-4.1.24 tomcat
#测试Tomcat正常安装:
#/usr/local/tomcat/bin/startup.sh
#通过IE Tomcat的页面正常显示

安装JK2 :
#cd /usr/local/src
#tar -xzvf jakarta-tomcat-connectors-jk2-2.0.2-src.tar.gz
#cd jakarta-tomcat-connectors-jk2-2.0.2-src
#cd jk/native2
#chmod 755 buildconf.sh
#./configure --with-apxs2=/usr/local/apache/bin/apxs --enable-EAPI
#make
#make install
#如果make install 不成功需要手工发布mod_jk2.so
#cd /usr/local/src/jakarta-tomcat-connectors-jk2-2.0.2-src/jk/build/jk2/apache2
#cp *.so /usr/local/apache/modules/

配置$CATLINA/conf/server.xml

debug=\"0\"/>
debug=\"0\"/>

port=\"8080\" minProcessors=\"5\" maxProcessors=\"75\"
enableLookups=\"true\" redirectPort=\"8443\"
acceptCount=\"100\" debug=\"0\" connectionTimeout=\"-1\"
useURIValidationHack=\"false\" disableUploadTimeout=\"true\" />
port=\"8009\" minProcessors=\"5\" maxProcessors=\"75\"
enableLookups=\"true\" redirectPort=\"8443\"
acceptCount=\"10\" debug=\"0\" connectionTimeout=\"-1\"
useURIValidationHack=\"false\"
protocolHandlerClassName=\"org.apache.jk.server.JkCoyoteHandler\"/>




prefix=\"catalina_log.\" suffix=\".txt\"
timestamp=\"true\"/>

unpackWARs=\"true\" autoDeploy=\"true\">
directory=\"logs\" prefix=\"localhost_log.\" suffix=\".txt\"
timestamp=\"true\"/>



#编辑
#vi /usr/local/tomcat/conf/jk2.properties
# list of needed handlers.
handler.list=channelSocket,request
# Override the default port for the channelSocket
channelSocket.port=8009

#编辑文件:
#vi /usr/local/apache/conf/workers2.properties
# only at beginnin. In production uncomment it out
[logger.apache2]
level=DEBUG
[shm]
file=/usr/local/apache/logs/shm.file
size=1048576
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# Uri mapping
[uri:192.168.0.90/*.jsp]
worker=ajp13:localhost:8009
[uri:211.167.83.165/*.jsp]
worker=ajp13:localhost:8009
#编辑http.conf
#修改
DocumentRoot \"/usr/local/tomcat/webapps\"
#添加index.jsp
DirectoryIndex index.html index.html.var index.jsp

LoadModule jk2_module modules/mod_jk2.so

Order deny,allow
Deny from all
#
# Order deny,allow
# Deny from all
#

Order Allow,Deny

ServerName 
ServerAlias www
ServerAlias localhost
ServerAlias 192.168.0.90
ServerAlias 211.167.83.165
ServerAdmin 
DocumentRoot /usr/local/tomcat/webapps
ErrorLog logs/home.net-errorlog
CustomLog logs/home.net-access.log common

JkUriSet worker ajp13:localhost:8009


在配置server.xml 的时候:
配置管理端口 和连接的端口顺序颠倒一下
在 catalina.out 可以观察到:
这样用apache 连接的时候,就不用等待了.

port=\"8009\" minProcessors=\"5\" maxProcessors=\"75\"
enableLookups=\"true\" redirectPort=\"8443\"
acceptCount=\"10\" debug=\"0\" connectionTimeout=\"0\"
useURIValidationHack=\"false\"
protocolHandlerClassName=\"org.apache.jk.server.JkCoyoteHandler\"/>

port=\"8080\" minProcessors=\"5\" maxProcessors=\"75\"
enableLookups=\"true\" redirectPort=\"8443\"
acceptCount=\"100\" debug=\"0\" connectionTimeout=\"20000\"
useURIValidationHack=\"false\" disableUploadTimeout=\"true\" />
#server.xml 不支持中文的注释
#对 shared/classes 目录下的java进行的修改不能立刻的反应到jsp中标.不能立即起作用.
以上的安装同样适合jakarta-tomcat-5.0.12 在以下的配置中注意
#在配置 jakarta-tomcat-5.0.12 的时候,注意 server.xml 中
没有封闭.
BUG:
在catalina.out 报错误.
总体上感觉tomcat 5.0 比4.x在性能上是有了改进.启动的速度快.

 

相关文章

  • Apache、SSL、MySQL和PHP平滑无缝地安装

    Apache、SSL、MySQL和PHP平滑无缝地安装

    Apache、SSL、MySQL和PHP平滑无缝地安装的目的 我们的目标是安装一个允许我们托管多个网站的web服务器,其中一些是针对电子商务的安全解决方案,而大部分网站是通过连接一个数据库服务器并且提取其数据的脚本驱动的。
    2008-03-03
  • Apache+PHP4.0+Sybase安装文档

    Apache+PHP4.0+Sybase安装文档

    Apache + PHP 4.0 + Sybase 安装文档 蓝森林 2001年5月16日 00:59 作 者: wangwei (  -BLUG ) [目的] 使用linux 构架web服务器, 连接小型机上的Sybase数据库。我们在Sybase服务器上安装了一个实验的数据库,数据库名为test, test中有一个表是Province, 字段有Province_id, Province。 Province_id Province
    2008-03-03
  • Apache rewrite重写规则的常见应用

    Apache rewrite重写规则的常见应用

    ---- 本文旨在提供如何用Apache重写规则来解决一些常见的URL重写方法的问题,通过常见的实例给用户一些使用重写规则的基本方法和线索。
    2008-03-03
  • mysql双机热备份的实现步骤

    mysql双机热备份的实现步骤

    mysql双机热备份的实现步骤...
    2007-05-05
  • Windows 2003 IIS 6.0 搭建可建虚拟机的asp+.net+php+jsp+mysql+mssql

    Windows 2003 IIS 6.0 搭建可建虚拟机的asp+.net+php+jsp+mysql+mssql

    Windows 2003 IIS 6.0 搭建可建虚拟机的asp+.net+php+jsp+mysql+mssql...
    2007-05-05
  • Rewrite.dll生成html

    Rewrite.dll生成html

    Rewrite.dll生成html...
    2007-02-02
  • 安装Apache和PHP的一些补充

    安装Apache和PHP的一些补充

    PHP的安装步骤,网上有很多资料,都非常详细。但是,由于Apache,PHP这类自由软件的安装并不象商业软件那样有一个友好的用户界面,许多网友又很少碰上这类东东,所以尽管旁边有一份安装资料,但还是碰上许多问题。我在国内许多关于Linux和php的论坛上,也注意到了不少网友总问相似的问题。因此,我把我所知道的这类问题的解决方法写出来,不对的地方,还请各位指出。
    2008-03-03
  • 用windows计划任务实现服务器定时重启

    用windows计划任务实现服务器定时重启

    用windows计划任务实现服务器定时重启...
    2007-07-07
  • iis Web站点崩溃的原因分析

    iis Web站点崩溃的原因分析

    iis Web站点崩溃的原因分析...
    2007-08-08
  • IIS和tomcat5多站点配置流程

    IIS和tomcat5多站点配置流程

    win2000server IIS和tomcat5多站点配置步骤详细解析
    2008-03-03

最新评论