以下步骤由 Application Server 9.1 的安装程序自动执行。但是,如果使用的是 GlassFish v2,将需要手动执行这些步骤。
在 Web 服务器实例的 magnus.conf 文件中,添加以下行:
##BEGIN EE LB Plug-in Parameters Init fn="load-modules" shlib="web-server-install-dir/plugins/lbplugin/bin/libpassthrough.so" funcs="init-passthrough,service-passthrough,name-trans-passthrough" Thread="no" Init fn="init-passthrough" ##END EE LB Plug-in Parameters=
如果以下行尚不存在,请附加该行:
Init fn="load-modules" shlib=".../libj2eeplugin.so" shlib_flags="(global|now)"
在文件 web-server-install-dir/config/obj.conf 中,在首次出现的字符串 nametrans 之前在单行中插入以下内容:
Nametrans fn="name-trans-passthrough" name="lbplugin" config-file="web-server-install-dir/config/loadbalancer.xml"
NameTrans 条目在 obj.conf 中的显示顺序非常重要。安装程序会将 NameTrans 条目放在正确的位置,但是,如果要因其他目的而编辑 obj.conf,必须确保顺序仍然正确。尤其是,负载平衡器信息必须在 document-root 函数之前显示。有关 obj.conf 文件的更多信息,请参见《Sun Java System Web Server 7.0 Administrator’s Configuration File Reference》。
将以下行附加到文件 web-server-install-dir/config/obj.conf 中:
<Object name = "lbplugin"> ObjectType fn="force-type" type="magnus-internal/lbplugin" PathCheck fn="deny-existence" path="*/WEB-INF/*" Service type="magnus-internal/lbplugin" fn="service-passthrough" Error reason="Bad Gateway" fn="send-error" uri="$docroot/badgateway.html" </Object>
编辑 web-server-install-dir /start 脚本,将 LD_LIBRARY_PATH 值更新为包括 app-server-install-dir/lib/lbplugin/lib。
app-server-install-dir /lib/lbplugin/lib 目录包含负载平衡器插件所需的二进制文件。
(可选的)对于基于 DAS 的新负载平衡器管理,配置 Web 服务器的 SSL 功能。
有关 Web Server 6.1 的详细说明,请参见在 SSL 模式下为 Sun Java System Web Server 6.1 设置负载平衡器 。
有关 Web Server 7 的详细说明,请参见在 SSL 模式下为 Web Server 7 设置负载平衡器。
如果 Web 服务器尚未运行,请启动它。