苦逼房奴一枚
全部博文(65)
分类: LINUX
2009-08-28 18:05:12
(相关环境jdk1.6.0 tomcat6 apache2.11 jk-1.2.15)
软件jdk-6u14-linux-i586.bin jakarta-tomcat-connectors-1.2.15-src.tar.gz
httpd-2.2.11.tar.gz apache-tomcat-6.0.18.tar.gz
各包下载链接
1、 安装配置jdk1.6,下载页面: ,找到“JDK
6 Update 14 ”(本文档编辑时)后面的“Download”,在出现下载页面的时候,要先点击“Accept
License Agreement ”的基础上,选择“Linux
self-extracting file”,下载并保存到客户端(自用PC)的适当位置。然后,通过FTP方式上传到服务器上。并将其置于root用户的根目录下。
#chown
root. jdk-6u14-linux-i586.bin ← 改变二进制压缩包的归属为root
#chmod 700 jdk-6u14-linux-i586.bin ← 改变属性为700
#./jdk-6u3-linux-i586.bin ← 执行,解压二进制包
……………………………………
……………………………………
……中间阅读协议信息省略……
……协议阅读中按空格翻页……
……………………………………
……………………………………
Yes
Unpacking
……………………………………
……………………………………
………中间提示信息省略………
……………………………………
……………………………………
#mv
jdk
#
rm -f jdk-6u14-linux-i586.bin ← 删除安装后遗留的源文件
2.安装Tomcat5
#wget
#tar zxvf apache-tomcat-6.0.18.tar.gz
#mv apache-tomcat-6.0.18
/usr/local/tomcat
#rm -f apache-tomcat-6.0.18.tar.gz
3.定义相关的环境变量
#vi /etc/profile ← 编辑环境变量文件,添加如下语句到文件文尾
export JAVA_HOME=/usr/local/jdk
export
PATH=$PATH:$JAVA_HOME/bin
export
CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
export
TOMCAT_HOME=/usr/local/tomcat
export
CATALINA_HOME=/usr/local/tomcat
export
CLASSPATH=$CLASSPATH:$CATALINA_HOME/common/lib
#source
/etc/profile ← 使环境变量生效
#/usr/local/tomcat/bin/catalina.sh
start 启动tomcat
用netstat –ntl 会出现8080 端口被子打开,用IE打开,能看到变态的小猫,说明安tomcat OK
3.编译安装apache
下载httpd-2.2.11.tar.gz
#tar zxvf h httpd-2.2.11.tar.gz
#cd httpd-2.2.11
# cd srclib/apr
&& ./configure --prefix=/usr/local/apr && make && make
install && cd ../apr-util && ./configure
--prefix=/usr/local/apr-util --with-apr=/usr/local/apr && make
&& make install && cd ../.. && ./configure --prefix=/usr/local/httpd
--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so
&& make && make install
(编译参数可选以下参数:--enable-module=so
--enable-module=usertrack --enable-modules=fastcgi --enable-info
--enable-suexec --with-mpm=worker --enable-expires --enable-headers
--enable-deflate --enable-file-cache --enable-cache --enable-disk-cache
--enable-mem-cache)
#/usr/local/httpd/bin/apachectl
start
用IE打开看到it’ work 说明 apache编译成功
4. 编译安装jakarta-tomcat-connectors
#tar xvzf jakarta-tomcat-connectors-1.2.15-src.tar.gz
#cd jakarta-tomcat-connectors-1.2.15-src/jk/native
#./buildconf.sh
#./configure --with-apxs=/usr/local/httpd/bin/apxs
# make
&& make install执行后应该在/usr/local/httpd/modules/可以看到mod_jk.so
5.整合配置
#cp
/usr/local/httpd/conf/httpd.conf /usr/local/httpd/conf/httpd.conf.bak
在/usr/local/httpd/conf/下编辑两个文件workers.properties mod_jk.conf
#vi mod_jk.conf
#
..mod_jk............workers.properties...
JkWorkersFile
/usr/local/httpd/conf/workers.properties
# Where to put jk
logs
JkLogFile
/var/log/httpd/mod_jk.log
# Set the jk log
level [debug/error/info]
JkLogLevel info
# Select the log
format
JkLogStampFormat
"[%a %b %d %H:%M:%S %Y]"
# JkOptions
indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
#
JkRequestLogFormat set the request format
JkRequestLogFormat
"%w %V %T"
# ...servlet
.jsp....ajp13.....Tomcat..Tomcat...
JkMount
/servlet/* worker1
JkMount /*.jsp
worker1
JkMount /*.htm
worker1
JkMount /*.do
worker1
JkMount
/*.svl worker1
#vi
workers.properties
# Defining a worker named worker1 and of
type ajp13
worker.list=worker1
# Set properties for worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300
#vi
/usr/local/httpd/conf/httpd.conf修改以后地方
ServerName
10.2.2.1:80
DocumentRoot
"/var/wwwroot"
Options Includes FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
XBitHack on
Order deny,allow
Deny from all
#
# DirectoryIndex:
sets the file that Apache will serve if a directory
# is requested.
#
DirectoryIndex index-1.html
LoadModule
jk_module modules/mod_jk.so
Include
/usr/local/httpd/conf/mod_jk.conf
如果要显示动态的图片(如验证码等,要先弄清其文件类型,然后加上)
kMount /*.svl worker1
最后修改tomcat的配置
#vi
/usr/local/tomcat/conf/server.xml
在Host配置中加入
然后重起两个服务,就OK了,注意先起tomcat再起httpd