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文档
# 或者查看 http://www.cnfug.org/journal/3/02.html
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
安装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 www.home.net
serveralias www
serveralias localhost
serveralias 192.168.0.90
serveralias 211.167.83.165
serveradmin webmater@5757.com
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在性能上是有了改进.启动的速度快.