2008-04-08
CentOS 5.0环境下配置apache+tomcat
关键字: centos5 apache tomcat 整合
1.apache (使用CentOS自带的apache,/etc/httpd)
当然也可以自己安装一个,下载apache,然后解压缩
首先要先安装APR
cd srclib/apr
#./configure --prefix=/usr/local/apr
#make
#make install
安装APR-util
cd srclib/apr-util
#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
#make
#make install
cd apache目录
# ./configure --prefix=/usr/local/apache
--enable-so --enable-mods-shared=all
--enable-cgi
--with-apr=/usr/local/apr
--with-apr-util=/usr/local/apr-util/bin
#make
#make install
这里可以把所有模块都编译了,省得后面麻烦,然后在http.conf再把不需要的模块注释掉!
2.jre
下载jre-1_5_0-linux-i586.bin
#chmod a+x jre-1_5_0-linux-i586.bin
#vi /etc/profile
在最后加入以下语句
export JAVA_HOME=/usr/local/jdk
export CLASSPATH=$JAVA_HOME/lib
3.tomcat
解压缩,直接运行,访问http://localhost:8080 ,应该可以看到小猫!
4.整合tomcat和apache
整合的工具mod_jk,去tomcat网站下载connector包
解压缩,进入native,编译成功后记得copy到apache的modules里面
#./configure --with-apxs=/usr/sbin/apxs
#make
#cp apache-2.0/mod_jk.so /etc/httpd/modules/
注:如果是用CentOS自带的apache,需要安装#yum install httpd-devel
修改http.conf:
vi /etc/httpd/conf/httpd.conf
把NameVirtualHost *:80前面注释去掉,在结尾加上:
<VirtualHost *:80>
ServerName examples.andy.com
RewriteEngine On
RewriteRule ^\/$ http://examples.andy.com/examples [R,L]
JkMount /* examples
</VirtualHost>
然后#vi /etc/httpd/conf.d/jk.conf
添写如下内容
LoadModule jk_module modules/mod_jk.so
JkLogFile /var/log/httpd/mod_jk.log
JkLogLevel info
JkWorkerProperty worker.list=examples
JkWorkerProperty worker.examples.type=ajp13
JkWorkerProperty worker.examples.host=localhost
JkWorkerProperty worker.examples.port=8009
JkWorkerProperty worker.examples.connection_pool_timeout=600
JkWorkerProperty worker.examples.socket_keepalive=True
JkWorkerProperty worker.examples.socket_timeout=60
记住如果有多个虚拟主机,就把每个[JkMount /* 别名]这里的别名在jk.conf里面定义多个就可以了!
直接启动apache,tomcat,输入http://examples.andy.com 是不是会跳转到tomcat的例子程序上去了呢!^ ^ 别忘了修改你的hosts文件哦!
当然也可以自己安装一个,下载apache,然后解压缩
首先要先安装APR
cd srclib/apr
#./configure --prefix=/usr/local/apr
#make
#make install
安装APR-util
cd srclib/apr-util
#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
#make
#make install
cd apache目录
# ./configure --prefix=/usr/local/apache
--enable-so --enable-mods-shared=all
--enable-cgi
--with-apr=/usr/local/apr
--with-apr-util=/usr/local/apr-util/bin
#make
#make install
这里可以把所有模块都编译了,省得后面麻烦,然后在http.conf再把不需要的模块注释掉!
2.jre
下载jre-1_5_0-linux-i586.bin
#chmod a+x jre-1_5_0-linux-i586.bin
#vi /etc/profile
在最后加入以下语句
export JAVA_HOME=/usr/local/jdk
export CLASSPATH=$JAVA_HOME/lib
3.tomcat
解压缩,直接运行,访问http://localhost:8080 ,应该可以看到小猫!
4.整合tomcat和apache
整合的工具mod_jk,去tomcat网站下载connector包
解压缩,进入native,编译成功后记得copy到apache的modules里面
#./configure --with-apxs=/usr/sbin/apxs
#make
#cp apache-2.0/mod_jk.so /etc/httpd/modules/
注:如果是用CentOS自带的apache,需要安装#yum install httpd-devel
修改http.conf:
vi /etc/httpd/conf/httpd.conf
把NameVirtualHost *:80前面注释去掉,在结尾加上:
<VirtualHost *:80>
ServerName examples.andy.com
RewriteEngine On
RewriteRule ^\/$ http://examples.andy.com/examples [R,L]
JkMount /* examples
</VirtualHost>
然后#vi /etc/httpd/conf.d/jk.conf
添写如下内容
LoadModule jk_module modules/mod_jk.so
JkLogFile /var/log/httpd/mod_jk.log
JkLogLevel info
JkWorkerProperty worker.list=examples
JkWorkerProperty worker.examples.type=ajp13
JkWorkerProperty worker.examples.host=localhost
JkWorkerProperty worker.examples.port=8009
JkWorkerProperty worker.examples.connection_pool_timeout=600
JkWorkerProperty worker.examples.socket_keepalive=True
JkWorkerProperty worker.examples.socket_timeout=60
记住如果有多个虚拟主机,就把每个[JkMount /* 别名]这里的别名在jk.conf里面定义多个就可以了!
直接启动apache,tomcat,输入http://examples.andy.com 是不是会跳转到tomcat的例子程序上去了呢!^ ^ 别忘了修改你的hosts文件哦!
发表评论
- 浏览: 12396 次
- 性别:

- 来自: 北京

- 详细资料
搜索本博客
我的相册
001
共 3 张
共 3 张
最近加入圈子
最新评论
-
cas-client-3.1.1的客户端 ...
我按照你的配置怎么都跑不起来,现在很急啊,你实地配成功过没有。另外3.1.1的单 ...
-- by luojunlt -
在frameset中的登陆界面se ...
没看明白什么意思!!o(∩_∩)o...能力问题?
-- by guojingxf -
cas-client-3.1.1的客户端 ...
不是,就是一个spring容器上下文管理的xml文件
-- by kj2ff -
cas-client-3.1.1的客户端 ...
请问下面的casContent.xml是什么文件?acegi的配置文件么?
-- by yangeou -
linux 中文显示乱码解决办 ...
好东西啊,正在找这个,呵呵
-- by flysky9820000






评论排行榜