Chinaunix首页 | 论坛 | 博客
  • 博客访问: 10804244
  • 博文数量: 2905
  • 博客积分: 20098
  • 博客等级: 上将
  • 技术积分: 36298
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-23 05:00
文章存档

2012年(1)

2011年(3)

2009年(2901)

分类: LINUX

2009-03-23 11:18:05

Apache+Tomcat整合小记
所需软件:
1、    jdk-6u6-linux-i586.bin
2、    apache-tomcat-5.5.26.tar.gz
3、    tomcat-connectors-1.2.26-src.tar.gz

前篇文章已经完成Apache的安装,因此这里不再介绍,具体安装步骤请参考前篇文章;
设置环境变量;
/etc/profile


使环境变量生效
[root@server ~]# source /etc/profile
注意:JAVA及TOMCAT的目录是否为安装目录;
首先安装JDK
我的软件下载都放在/home/soft里面,每个人的目录都不一样,对号入座;
[root@server ~]# cp /home/soft/jdk-6u6-linux-i586.bin /usr/local/
[root@server local]# ./jdk-6u6-linux-i586.bin
……………………
I. Installation and Auto-Update. The Software's
installation and auto-update processes transmit a limited
amount of data to Sun (or its service provider) about those
specific processes to help Sun understand and optimize
them. Sun does not associate the data with personally
identifiable information. You can find more information
about the data Sun collects at
For inquiries please contact: Sun Microsystems, Inc., 4150
Network Circle, Santa Clara, California 95054, U.S.A.
Do you agree to the above license terms? [yes or no]
yes
…………
the JDK installation directory) in a browser.
For more information on what data Registration collects and
how it is managed and used, see:

Press Enter to continue.....
Done.
所有安装,按空格,到提示时输入YES,最近提示按ENTER键结束;
查看当前JAVA版本;
[root@server local]# java -version
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)
上面显示表明JAVA安装成功没有出错;
[root@server local]mv jdk1.6.0_06/ java

安装TOMCAT,直接解压到/usr/local目录即可;
[root@server local]# tar zxvf /home/soft/apache-tomcat-5.5.26.tar.gz
[root@server local]# mv apache-tomcat-5.5.26 tomcat

编译安装Mod_jk
[root@server local]# tar zxvf /home/soft/tomcat-connectors-1.2.26-src.tar.gz
[root@server local]# cd tomcat-connectors-1.2.26-src/native/
[root@server native]# ./configure --with-java-home=/usr/local/java/ \
> --with-apxs=/usr/local/apache/bin/apxs
[root@server native]# make clean; make
[root@server native]# make install
[root@server native]# cp apache-2.0/mod_jk.so /usr/local/apache/lib/
以上完成编绎安装,开始设定Apache,让mod_jk 生效。
编辑 httpd.conf
在 httpd.conf 中加入mod_jk模块
# LoadModule foo_module modules/mod_foo.so
    LoadModule    jk_module  lib/mod_jk.so
  # Where to find workers.properties
  # Update this path to match your conf directory location (put workers.properties next to httpd.conf)
  JkWorkersFile /usr/local/apache/conf/workers.properties
这个目录是根据自己安装目录来设定,不能照搬;
  # Where to put jk shared memory
  # Update this path to match your local state directory or logs directory
  JkShmFile     /var/log/httpd/mod_jk.shm
  # Where to put jk logs
  # Update this path to match your logs directory location (put mod_jk.log next to access_log)
  JkLogFile     /var/log/httpd/mod_jk.log
  # Set the jk log level [debug/error/info]
  JkLogLevel    info
  # Select the timestamp log format
  JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
  # Send everything for context / to worker named worker1 (ajp13)
 JkMount  /*.jsp worker1
具体设置参数为如下图;


编辑workers.properties文件;
[root@server native]# vi /usr/local/apache/conf/workers.properties


重启APACHE与TOMCAT服务;
[root@server ~]# /usr/local/apache/bin/apachectl start
[root@server ~]# /usr/local/tomcat/bin/catalina.sh start
在客户端通过IE访问;


    完成以上操作后,即可实现Apache+Tomcat的简单整合;整个配置过程,都是依照官方文档进行操作;之前照搬过一些文档,有较大出入,绕了不少弯;在此,给点建议,多看看文档,会让自己受益匪浅;文章如有不足之处,欢迎博友们多指教;THX。。。。。

阅读(2180) | 评论(0) | 转发(0) |
0

上一篇:kernel panic

下一篇:Linux 用户账号管理

给主人留下些什么吧!~~