注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 最简单的破解 windows XP..
 帮助

Apache+Tomcat整合小记


2008-08-05 15:21:18
 标签:LINUX   [推送到技术圈]

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://liang831002.blog.51cto.com/188904/91171
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 http://java.com/data/.
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:
http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html
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。。。。。

本文出自 “&随便混混& &用心感受每一天&” 博客,请务必保留此出处http://liang831002.blog.51cto.com/188904/91171





    文章评论
 
2008-08-05 15:25:17
頂一下 不錯

2008-08-05 17:51:48
顶一下,顶一下!
以后自己要写相关的内容时,一定再来学习借鉴一下!

2008-08-06 11:59:22
来了解一下,以前对这方面的知识了解的不是很多。  

2008-08-07 09:12:02
2008年了,还在用mod_jk

2008-08-09 00:47:14
嗯~不错,我也部署过tomcat

2008-08-13 15:45:57
你好.可以和你聊聊么,
478723599我的QQ

 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: