Configure Proxy Servers

In this OBE tutorial, you install and configure the WLS proxy plug-in for an Apache Web server. This proxy is configured to load balance incoming requests to your existing cluster. Finally, you verify proper load balancing and failover by using a supplied JavaEE Web application.

Approximately 30 minutes

Topics

This OBE tutorial covers the following topics:

Deploying a Web Application to a Cluster
Testing a Web Application via Apache

 

Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: Because this action loads all screenshots simultaneously, response time may be slow depending on your Internet connection.)

Alternatively, you can place the cursor over each individual icon in the following steps to load and view only the screenshot associated with that step.

Overview

Plug-ins enable WebLogic Server to integrate with applications deployed on Apache HTTP Server, Netscape Enterprise Server, or Microsoft’s Internet Information Server. This includes load balancing HTTP requests across a WebLogic cluster, and automatically failing over failed requests due to a server not being available. These plug-ins also integrate with the HTTP session replication features of WebLogic.

The plug-in for the Apache HTTP Server proxies requests based on the URL of the request (or a portion of the URL). This is called proxying by path. You can also proxy requests based on the Multipurpose Internet Mail Extensions (MIME) type of the requested file. Alternatively, you can use a combination of the two methods.

Back to Topic List

System Requirements

Make sure that your system environment meets the following requirements:

Software Requirements

Before starting this tutorial, download and install the following software if not already installed:

Apache HTTP Server 2.X

Before starting this tutorial, first complete the following prerequisite tutorials:

Installing and Configuring Oracle WebLogic Server
Configuring Oracle WebLogic Server Managed Instances
Create a Basic Cluster

 

Minimum Hardware Requirements

Item Specification
Processor Speed 1 GHz
Memory 2 GB
Free Hard Disk Space 1 GB

Back to Topic List

Installing the Apache Plug-in

Perform the following steps:

1.

Shut down your Apache server if it is running. For example, on Linux, locate the apachectl script and enter the following command from a shell:

> apachectl stop

This script is typically found under <APACHE_HOME>/bin, where <APACHE_HOME> is the root directory of your Apache installation. Typical values for <APACHE_HOME> on Linux are /usr/local/apache2 or /etc/httpd.

Tip: On most Linux environments, the default Apache installation can be managed only by the root user.



2.

Follow the instructions here to download an archive containing the WebLogic Apache plug-in. Extract the downloaded archive.



3.

Within the contents of this archive, locate the required plug-in module file, <OS>/<ARCH>/<MODULE>, where:

<OS> = your operating system, such as Linux or Windows
<ARCH> = your hardware architecture, such as i686 or x86_64
<MODULE> = mod_wl_20.so for Apache 2.0 or mod_wl_22.so for Apache 2.2



4.

Copy the module file to <APACHE_HOME>/modules.



Back to Topic List

Configuring the Apache Plug-in

Perform the following steps:

1.

Edit the <APACHE_HOME>/conf/httpd.conf file.

Tip: Make a backup copy of this file.



2.

Locate the line that starts with:

# Dynamic Shared Object (DSO) Support


Add the following line to the list of modules, depending on your version of Apache:

LoadModule weblogic_module modules/mod_wl_20.so
LoadModule weblogic_module modules/mod_wl_22.so



3.

Add the following to the end of the file. Use the specific IP addresses and port numbers of your three clustered managed servers:

<IfModule mod_weblogic.c>
    WebLogicCluster 127.0.0.1:7003,127.0.0.1:7005,127.0.0.1:7007
    MatchExpression /*
</IfModule>
<Location /weblogic>
    SetHandler weblogic-handler
    WebLogicCluster 127.0.0.1:7003,127.0.0.1:7005,127.0.0.1:7007
    PathTrim /weblogic
</Location>


4.

Use Apache to validate your configuration changes. For example, on Linux, enter the following command from a shell:

> apachectl configtest



5.

Restart Apache. For example, on Linux, enter the following command from a shell:

> apachectl start

You can confirm that Apache started successfully by connecting to it from a Web browser. For example, if Apache is configured to use port 80, use the URL http://localhost.


Back to Topic List

Deploying a Web Application to a Cluster

Perform the following steps:

1.

Start your administration and clustered managed servers, if not already started.

2.

Download the browsestore.zip file that contains the sample Web application browsestore.war file.

 



3. Launch the administration console. Click Lock & Edit in the Change Center panel. Then select Deployments from the Domain Structure panel.

4.

Click the Install button.



5.

Either enter the path to browsestore.war or use the supplied links to browse to its location:


Click the Next button.

6.

Click the Next button to install an application.


7.

Select the check box to target the application to your entire cluster:


Click the Next button.

8. Click the Finish button.

9.

Click Activate Changes in the Control Center panel.


10.

Select the check box for the browsestore application, and select Start > Servicing All Requests:


Click Yes when prompted.

 Back to Topic List

Testing a Web Application via Apache

Perform the following steps:

1.

Direct your Web browser to the browsestore application, but using Apache:

http://localhost:<APACHE_PORT>/browsestore

 

<APACHE_PORT> is the port your Apache installation is configured to bind to. For example, if Apache is running on port 80, use http://localhost/browsestore.



2.

Check the command shells from which you started your managed servers. Use the output messages to confirm which server the request was directed to:


"serviced request for the welcome page"



3. Click the Browse Store link in the application. Select a category check box and click the Retrieve Items button.



4.

Once again, check which server each of the prior requests was routed to:


"serviced the request to browse the store"

"serviced request to print items"



5.

Kill the server that handled the most recent request.


6.

Return to your Web browser, and use the application to select a different category. Apache should avoid the failed server with no interruption to the client.



 Back to Topic List


In this lesson, you learned how to:

Install the WLS Apache plug-in for a target platform

Back to Topic List

Place the cursor over this icon to hide all screenshots.