卸载:
卸载非常容易,在Fedora8的图形界面环境下,打开程序菜单,找到更新程序项,点击后出现对话框,将列表中httpd和tomcat服务前的钩去掉,确定,卸载完毕;
更新JDK
1.从www.sun.com下载最新的JDK版本,我下载的是jdk-6u5-linux-i586.bin
2.安装 ./ jdk-1_5_0_06-linux-i586.bin
3.设置环境变量
[root@localhost local]# vi /etc/profile
在该文件的末尾加上下面两行
export JAVA_HOME=/usr/local/jdk
export CLASSPATH=$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
安装apache
apache的安装也很简单
1.从www.apache.org 下载最新的http server版本,我下载的是httpd-2.2.8.tar.gz;
2.进行解压
3.配置安装参数:[root@localhost httpd-2.2.8]# ./configure --prefix=/usr/local/apache --enable-so --enable-mods-shared=all ;加载全部模块,之后可在配置文件中禁用不需要的模块
4.编译 make 安装 make install
5.启动 [root@localhost bin]# ./apachectl start 测试 http://127.0.0.1 页面出现 It Works! 安装成功!
安装tomcat
同样简单
1. 从www.apache.org 下载最新的apache tomcat版本,我下载的是 apache-tomcat-6.0.16-deployer.tar.gz;
2. 进行解压
3. 设置环境变量CATALINA_HOME,并验证
[root@localhost local]# vi /etc/profile
在文件最后加入如下一行
export CATALINA_HOME=/usr/local/tomcat
保存退出
4.启动 测试 访问127.0.0.1:8080 出现大猫,安装成功!
整合apache+tomcat
整合过程稍费周折,但也还不是太麻烦
1.从www.apache.org下载转发功能模块tomcat-connectors的最新版本,我下载的是tomcat-connectors-1.2.26-src.tar.gz;
2.进行解压
3.到解压后的native目录进行安装配置,指定apache目录tomcat目录和JDK目录位置, [root@localhost native]#./configure --with-apxs=/usr/local/apache/bin/apxs --with-tomcat=/usr/local/tomcat --with-java-home=/usr/java/jdk --with-jni
4.运行配置命令后,提示我zlib包找不到。。。只好去下载安装zlib ,也较为简单,不再累述;
5.配置正确完成后,进行编译 make
6.编译结束后到native下的apache-2.0目录下看看,应该生成了一个mod_jk.so文件,这就是转发模块,将其拷贝至apache安装目录下的modules目录
7.修改apache/conf目录下的httpd.conf文件,在LoadModule的部分添加如下内容,使apache加载转发模块:
LoadModule jk_module modules/mod_jk.so
# Declare the module for
#AddModule mod_jk.c
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile conf/workers.properties
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
#JkLogFile logs/mod_jk.log
# JkLogFile "|/opt/webserver/apache2/bin/rotatelogs /opt/logs/mod_log/mod%Y_%m_%d.log 86400 480"
# 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"
# Send everything for context /examples to worker named worker1 (ajp13)
#JkMount /* balancer
JkMountFile conf/uriworkermap.properties
JkShmFile logs/jk.shm
SetHandler server-status
JkMount status
Order deny,allow
Deny from all
Allow from all
8.在apache/conf目录下创建两个文件 workers.properties 和 uriworkermap.properties;
workers.properties 是转发模块的工作单定义转发主机和监听端口等内容,见下:
#
# workers.properties
#
# list the workers by name
worker.list=localhost,status
#workers
# ------------------------
# First tomcat server
# ------------------------
worker.localhost.port=8009
worker.localhost.host=127.0.0.1
worker.localhost.type=ajp13
#worker.localhost.socket_timeout=300
worker.localhost.lbfactor=1
# Status worker for managing load balancer
worker.status.type=status
#
# END workers.properties
#
uriworkermap.properties是定义工作单里每个工作项的转发规则的,见下:
# Simple worker configuration file
# Mount the Servlet context to the ajp13 worker
#/jmx-console=loadbalancer
#/jmx-console/*=loadbalancer
/examples/*=localhost
/jkstatus/=status
至此,整合操作全部完成,重启tomcat和apache,就可以通过http://127.0.0.1/examples 访问到tomcat的目录去了
另外要注意的是,转发模块在apache版本一致的情况下是可通用的,但如果apache版本不一致,就只能自己进行编译了。
bnn906708184 于 2012-07-10 17:31:23发表:
:0wpoi2