星期五, 十二月 03, 2004
实验笔记之Apache2.0.46与WLS8.13集成
前段时间装了一个 RHAS3 和其下的WLS8.13 ,根据网上的一些文章,做了一些测试实验,写点笔记,也算是自己的一个积累吧 ……
在一些大的 Web 应用的时,为了分担系统负担以及提高系统安全等原因,可以考虑将WebLogic的HTTP Server分离,而使用Apache HTTP Server来做 Http 解析;这可以通过安装Apache-WebLogic插件来实现。当客户端请求静态页面时,使用Apache Server,而当客户端请求动态页面时,Apache Server通过插件来使用WebLogic Server;对于客户端来说,WebLogic Server是隐藏的,提高了系统的安全行,而且WebLogic Server的所有服务都可以照常提高。
下面就是具体实验情况
系统平台:RedHat 3.0 服务器
[root@Linux105 bin]# uname -a Linux Linux105 |
Apache 是 RedHat 自带的 版本是 Apache/
[root@Linux105 bin]# httpd -version Server version: Apache/ Server built: Mar 1 2004 12:14:32 |
路径在 /etc/httpd 下
[root@Linux105 bin]# httpd -l Compiled in modules: core.c prefork.c http_core.c mod_so.c |
如果在列出的模块名中有mod_so.c,那么你的Apache已经支持so模块,
mod_so.c表明当前的Apache HTTP Server是动态加载的模式,可以和WebLogic进行整合。
否则需要重新编译Apache,在编译Apache时,需要加以下两个参数:
./configure --enable-module=so --enable-rule=SHARED_CORE
|
Weblogic 版本是 813 for linux 安装文件是 server813_linux32.bin
安装 Weblogic 用
[root@Linux105 pub]# chmod a+x server813_linux32.bin
|
改变执行权限,运行该程序安装以后在
./bea/weblogic81/common/bin/config.sh 来创建域
并在这个域下面用 ./startWebLogic.sh 启动 Weblogic
手工将bea/weblogic81/server/lib/linux/i686目录下面的mod_wl_20.so文件拷贝到/etc/httpd/modules/目录下面
不同的软硬件系统,到相应的lib目录去拷贝文件mod_wl_20.so。
以linux为例,在/usr/local/bea/weblogic81/server/lib/linux/就有i686、ia64、s390三个子目录。
修改 /etc/httpd/conf/ 下的 httpd.conf 文件,
# WebLogic Server 8.1 plug-in LoadModule weblogic_module modules/mod_wl_20.so WebLogicHost 172.16.48.105 WebLogicPort 7001 MatchExpression *.jsp MatchExpression *.do |
然后把httpd.conf文件中的
DocumentRoot "/var/www/html"
改为
DocumentRoot "/opt/pub/WL/DefaultWebApp"
,把
改为
把 AddDefaultCharset UTF-8
改为
AddDefaultCharset GB2312
[root@Linux105 bin]# httpd -t httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName Syntax OK |
测试通过,说明配置成功
这样就把 Apache 的起始目录设为和 Weblogic 一样。
重起 apache
[root@Linux105 bin]# /etc/rc.d/init.d/httpd restart 停止 httpd:[ 确定 ] 启动 httpd:httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [ 确定 ] |
这样,客户端请求静态页面时就直接访问 apache 服务器,而所有的 *.jsp和 *.do 的访问Apache Server通过插件访问WebLogic服务器 172.16.48.105 的 7001 端口,这样可以分摊服务器的负载。通过配置修改 /etc/httpd/conf/ 下的 httpd.conf 的文件还可以实现对 weblogic某个应用的单独发布……



