您當(dāng)前所在位置:
首頁 →
服務(wù)器 →
WEB服務(wù)器 →
tomcat 5.0 + apache 2.0 完全安裝
tomcat 5.0 + apache 2.0 完全安裝
時(shí)間:2015-06-28 00:00:00
來源:IT貓撲網(wǎng)
作者:網(wǎng)管聯(lián)盟
我要評(píng)論(0)
- 服務(wù)器環(huán)境:
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 支持動(dòng)態(tài)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 具體的修改請(qǐng)參考apache2.0文檔
# 或者查看 http://www.cnfug.org/journal/3/02.html
StartServers 10
MinSpareServers 25
MaxSpareServers 50
ServerLimit 2000
MaxClients 1500 #Apache可以同時(shí)處理的請(qǐng)求
MaxRequestsPerChild 10000
安裝Php :
下載: php-4.3.3.tar.gz
#cd /usr/local/src
#tar -xzvf
#php for apache 以apache modules的方式運(yùn)行
./configure --with-apxs2=/usr/local/apache/bin/apxs
#php run like shell 以單獨(dú)的shell方式運(yùn)行
./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文件放的目錄
#下面的參數(shù)是安裝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
#測(cè)試Tomcat正常安裝:
#/usr/local/tomcat/bin/startup.sh
#通過IE http://yourIP:8080/ 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 不成功需要手工發(fā)布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 [email protected]
DocumentRoot /usr/local/tomcat/webapps
ErrorLog logs/home.net-errorlog
CustomLog logs/home.net-access.log common
JkUriSet worker ajp13:localhost:8009
在配置server.xml 的時(shí)候:
配置管理端口 和連接的端口順序顛倒一下
在 catalina.out 可以觀察到:
這樣用apache 連接的時(shí)候,就不用等待了.
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 不支持中文的注釋
#對(duì) shared/classes 目錄下的java進(jìn)行的修改不能立刻的反應(yīng)到j(luò)sp中標(biāo).不能立即起作用.
以上的安裝同樣適合jakarta-tomcat-5.0.12 在以下的配置中注意
#在配置 jakarta-tomcat-5.0.12 的時(shí)候,注意 server.xml 中
沒有封閉.
BUG:
在catalina.out 報(bào)錯(cuò)誤.
總體上感覺tomcat 5.0 比4.x在性能上是有了改進(jìn).啟動(dòng)的速度快.關(guān)鍵詞標(biāo)簽:完全,安裝,true"&
相關(guān)閱讀
熱門文章
ISAPI Rewrite實(shí)現(xiàn)IIS圖片防盜鏈
IIS6.0下配置MySQL+PHP5+Zend+phpMyAdmin
在Windows服務(wù)器上快速架設(shè)視頻編解碼器全攻略
win2000server IIS和tomcat5多站點(diǎn)配置
人氣排行
XAMPP配置出現(xiàn)403錯(cuò)誤“Access forbidden!”的解決辦法
WIN2003 IIS6.0+PHP+ASP+MYSQL優(yōu)化配置
訪問網(wǎng)站403錯(cuò)誤 Forbidden解決方法
如何從最大用戶并發(fā)數(shù)推算出系統(tǒng)最大用戶數(shù)
Server Application Unavailable的解決辦法
報(bào)錯(cuò)“HTTP/1.1 400 Bad Request”的處理方法
Windows Server 2003的Web接口
http 500內(nèi)部服務(wù)器錯(cuò)誤的解決辦法(windows xp + IIS5.0)