Apache

This section discusses the process of configuring Apache to participate in WebLogic clusters. Apache is a Web server, the most popular one, actually. It runs on Unix/Linux, Windows, OS/X, and other platforms as well, but only HP-UX, Solaris, and Linux plug-ins are provided with WebLogic. Apache is free, open -source software available for download from

http://www.apache.org

In its most basic form, Apache provides very little functionality. In order to preserve its flexibility, the developers implemented virtually all of its functionality as modules. Most Apache modules are also available from the Web site above. Quite a few of them come with the default Apache distribution. Apache modules may be incorporated into the server in two ways:

  • They may built into the httpd executable when it is compiled, a process known as static inclusion (for Apache versions 1.3.x).

  • They may be compiled separately into dynamic shared objects and loaded into the server at run time.

Plug-In Installation (Static)

The HTTP server plug-in is implemented as an Apache module. This section discusses how to compile the HTTP server plug-in provided with your WebLogic distribution into an Apache server whose source code you have downloaded. If your Apache server is not already enabled for dynamic shared objects, this is probably the easiest method. You can determine whether your Apache module is so enabled for dynamic shared objects by typing:

 httpd -1  grep mod_so 

which tells your Apache server (httpd) to list the modules compiled into it (- option) and look for the shared object module. If mod_so is not found, shared objects are not enabled on your server. If you find all this talk of shared objects baffling, you should probably go with the static compilation method.

First, create a subdirectory in your Apache distribution to hold the WebLogic module. In a default installation [1] this will be in the following path under the ServerRoot [2] directory.

[1] Note that the distribution of Apache that comes with the most popular commercial distribution of Linux (RedHat) is not, repeat not, a default installation of Apache. The RedHat installation works fine if all you want is Apache, but for our purposes you are much better off building your own executable from source.

[2] ServerRoot is defined in your httpd.conf file.

 src/modules 

So, from the ServerRoot directory create a subdirectory called weblogic as follows :

 mkdir src/modules/weblogic 

The library file needed for compilation into a static httpd server is included in your WebLogic distribution. Under the bea/wlserver6.1 directory is a subdirectory called lib. Within that directory is a file libweblogic.a. If you are still in the ServerRoot directory, it can be copied as follows:

 cp /bea/wlserver6.1/libweblogic.a src/modules/weblogic 

Next, use the configure utility provided with the Apache distribution to build a make file that can be used to compile your httpd executable.

 configure --activate- module=src/modules/weblogic/libweblogic.a 

Use the make utility on your Unix/Linux system to build the httpd executable:

 make 

When that is successful, install the new executable:

 make install 

Dynamic Installation

If you're using Apache and your httpd executable is already configured for DSO support (check by typing httpd -lgrep mod_so ), the easiest way to install the WebLogic proxy plug-in is as a DSO. Assuming that your Apache server is already configured with shared object support, the Apache plug-in can be installed with a single line. Find the file mod_wl.so that was provided with your WebLogic server distribution. Change to the directory where that file is located. Install the WebLogic module with the following command.

 perl $SERVERROOT/bin/apxs -i -a -n weblogic mod_wl.so 

where "$SERVERROOT" is the ServerRoot directory of Apache as defined in your httpd.conf file, not an actual shell variable. If the above command comes back without complaint, check to make sure it put the following lines in your httpd.conf file:

 LoadModule weblogic_module AddModule mod_weblogic.c 

Finally, restart your Apache server with the apachectl script:

 apachectl restart 

Enable Proxying in Apache

After you have successfully installed the Apache plug-in, you still need to configure Apache to redirect requests for WebLogic resources to the appropriate servers. As with all Apache configuration, this is done by changing the directives in the httpd.conf file.

If you are proxying requests to a non clustered server, you need to define two Apache directives, WebLogicHost and WebLogicPort . WebLogicHost is the name or IP address of the WebLogic server. For performance reasons you would be better off using the IP address, but either will work. The WebLogicPort directive is the IP port on which the WebLogic server is listening for connections.

 <IfModule mod_weblogic.c>       WebLogicHost              192.168.0.1       WebLogicPort              7001 </IfModule> 

If you are proxying to a cluster of WebLogic servers, the WebLogicHost and WebLogicPort directives are replaced by the single directive WebLogicCluster , which takes as a parameter the list of all servers in the cluster:

 <IfModule mod_weblogic.c>    WebLogicCluster NT4-server:7001, RHat72server:7001 </IfModule> 

You still need to tell Apache what sort of pages to relay to the WebLogic server(s). This is usually done with the MatchExpression directive. MatchExpression is used to recognize MIME types based on file extensions. For example, the following configuration passes all requests for files ending in JSP (presumably Java Server Pages) on to the WebLogic cluster:

 <IfModule mod_weblogic.c>    WebLogicCluster NT4-server:7001, RHat72server:7001    MatchExpression *.jsp </IfModule> 

MatchExpression is equally valid with individual machines. Another method of distinguishing static page requests from requests for dynamic objects is by location. Say that you have your site configured so that all JSPs appear to the client to be in the directory /dynamic under your URL. If so, you could configure Apache as follows

 <IfModule mod_weblogic.c>    WebLogicCluster NT4-server:7001, RHat72server:7001    <Location /dynamic>       SetHandler weblogic-handler    </Location> </IfModule> 

The < Location > directive is used in pairs (< Location > < /Location >) to delimit those directives that will apply only to a portion of the URL. In this case, we are telling Apache that all client requests that involve the location /dynamic need to be handled by the weblogic-handler . A handler is an Apache concept and well outside the scope of this book. In this case it refers to the collection of services provided by the WebLogic module. In practice, what's going to happen is that the WebLogic module that we just installed in Apache is going to relay all requests to the /dynamic portion of the tree on to the two servers defined in the WebLogicCluster directive.



BEA WebLogic Server Administration Kit
BEA WebLogic Server Administration Kit (Prentice Hall PTR Advanced Web Development)
ISBN: 0130463868
EAN: 2147483647
Year: 2002
Pages: 134
Authors: Scott Hawkins

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net