Apache httpd-2.0.49 + Tomcat 4.1.30 + jk2 的安裝:
服務器環境:
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]#
編輯 /home/mms/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
JAVA_HOME=/usr/java2
export JAVA_HOME
JRE_HOME=/usr/java2/jre
export JRE_HOME
TOMCAT_HOME=/usr/local/tomcat4
export TOMCAT_HOME
CLASSPATH=/usr/java2/lib:/usr/java2/jre/lib
export CLASSPATH
PATH=$PATH:$HOME/bin:/usr/java2/bin:/usr/java2/jre/bin:/usr/local/tomcat4/bin
export LANG=en_US
export PATH
unset USERNAME
#查看是否正確
#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/apache2 --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.4.7.tar.gz
./configure --with-apxs2=/usr/local/apache2/bin/apxs --enable-track-vars --enable-debug --enable-url-includes --enable-sockets --with-config-file-path=/usr/local/php-4.4.7 --with-mysql=/usr/local/mysql
#make
#make install
#ls -l /usr/local/apache2/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 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 不成功需要手工發布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
#編輯
#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
[shm]
file=/usr/local/apache2/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:/examples/*]
worker=ajp13:localhost:8009
[uri:/web/*]
worker=ajp13:localhost:8009
[uri:/*]
worker=ajp13:localhost:8009
[uri:/manager/*]
worker=ajp13:localhost:8009
#編輯http.conf
#添加index.jsp
DirectoryIndex index.html index.html.var index.jsp
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
Satisfy all
</Directory>
紅色的地方讓gif,html可以訪問
<Directory />
Options FollowSymLinks
AllowOverride None
Options +Includes
</Directory>
<VirtualHost *>
ServerAdmin jianqiang.jiang@linktone.com
DocumentRoot /usr/local/tomcat4/webapps/web
ServerName www.jiang.com
DirectoryIndex index.htm index.html default.htm index.php index.jsp
ErrorLog /usr/local/tomcat4/webapps/web/logs
CustomLog logs/jiang common
</VirtualHost>
配置server.xml
<Engine name="Standalone" defaultHost="www.jiang.com" debug="0">
<Host name="www.jiang.com" debug="0" appBase="/usr/local/tomcat4/webapps/web"
unpackWARs="true" autoDeploy="true">
Apache的啟動經??吹竭@樣一個警告
[root@eygle conf]# apachectl start
httpd: Could not determine the server's fully qualified domain name, using 172.16.11.99 for ServerName
剛剛查了一下,找到了解決方法.
Your box's config does not allow Apache to find your server's FQDN (Fully Qualified Domain Name).
原因是Apache無法找到服務器的FQDN(Fully Qualified Domain Name).
最簡單的,修改httpd.conf文件,增加:
ServerName <server_name_or_ip_addr>
我的改為:
ServerName http://www.eygle.com/
再次啟動就正常了: