3 Configuring the Plug-In for Apache HTTP Server

For proxying requests from Oracle HTTP Server to Oracle WebLogic Server, use the mod_wl_ohs plug-in. This plug-in is similar to the plug-in for Apache HTTP Server. However, you do not need to download and install the plug-in separately. For information about configuring mod_wl_ohs, see Configuring the Plug-In for Oracle HTTP Server.

WebLogic Server Proxy Plug-in 12.2.1.0 and later version builds are moved from Intel compiler to MSVC Compiler. When Apache HTTP Server is used as a front end with WebLogic Server Proxy Plug-in, the plug-in library depends on the two dlls — msvcp110.dll and msvcr110.dll, provided by Microsoft. These dlls are available with Microsoft Visual C ++ Redistributable Package for x64.

To install and configure the Oracle WebLogic Server Proxy Plug-In for Apache HTTP Server, read the following sections:

Apache HTTP Server Support Note

The Oracle WebLogic Server Proxy Plug-In for Apache HTTP Server is supported on Apache 2.2 and 2.4 web servers and can front-end WebSocket applications.

Install the Oracle WebLogic Server Proxy Plug-In for Apache HTTP Server

After you download the Oracle WebLogic Server Proxy Plug-In for Apache HTTP Server, as described in Availability of Oracle WebLogic Server Proxy Plug-In, you can install it as an Apache HTTP Server module in your Apache HTTP Server installation.

Installation Prerequisites

Before you install the Oracle WebLogic Server Proxy Plug-In for Apache HTTP Server, complete these installation and verification tasks.

  • Download the Oracle WebLogic Server Proxy Plug-In for Apache HTTP Server, as described in Availability of Oracle WebLogic Server Proxy Plug-In.

  • Extract the plug-ins zip distribution to PLUGIN_HOME. For example, /home/myhome/weblogic-plugins-12.2.1.4.0/. This is the directory to which the extract the plug-in is extracted.

    This distribution contains these files:

    Table 3-1 Files Included in the Apache Web Server Plug-in Zip

    (path)/filename Description

    README.txt

    The README file for the plug-in.

    bin/orapki.bat

    orapki tool for configuring Oracle wallets

    jlib/*.jar

    orapki helper Java libraries

    lib/mod_wl.so

    WebLogic proxy module for Apache 2.2

    lib/*.so

    Helper libraries

    lib/mod_wl_24.so

    WebLogic proxy module for Apache 2.4

  • Install JDK 8 to use SSL. The JDK 8 installation is required to use the orapki utility, which manages public key infrastructure (PKI) elements, such as wallets and certificate revocation lists, for use with SSL.

  • Ensure that you have a supported Apache HTTP Server installation. See https://www.oracle.com/technetwork/middleware/ias/downloads/fusion-certification-100350.html.

  • Ensure that a supported version of Oracle WebLogic Server is configured and running on a target system. This server does not need to be running on the system on which you extracted the plug-in zip distribution. For the supported Oracle WebLogic Server versions, see https://www.oracle.com/technetwork/middleware/ias/downloads/fusion-certification-100350.html.

Installing the Apache HTTP Server Plug-In

The Oracle WebLogic Server Proxy Plug-In for Apache HTTP Server is distributed as a shared object (.so) file. You can obtain the plug-in here:

http://www.oracle.com/technetwork/middleware/webtier/overview/index.html

To install the Apache HTTP Server plug-in:

  1. Ensure that the weblogic-plugins-12.2.1.4.0/lib folder is included in LD_LIBRARY_PATH on UNIX systems (and PATH on Windows systems). If you do not do this, then you see linkage errors when starting Apache HTTP Server.
  2. In the location where you unzipped the downloaded plug-in file, locate lib/mod_wl.so; for example, /home/myhome/weblogic-plugins-12.2.1.4.0/lib/mod_wl.so.
  3. Verify that the mod_so.c module is enabled.

    If you installed Apache HTTP Server using the script supplied by Apache, mod_so.c is already enabled. Verify that mod_so.c is enabled by executing the following command:

    • UNIX/Linux

      APACHE_HOME/bin/apachectl -l
      

    (APACHE_HOME is the directory that contains the Apache HTTP Server installation.)

    This command lists all enabled modules. If mod_so.c is not listed, you must rebuild your Apache HTTP Server, making sure that the following configure option is specified:

    ...
    --enable-module=so
    ...
    
  4. Make a copy of the APACHE_HOME/bin/httpd.conf file for backup.
  5. Open the httpd.conf file.
  6. Depending on your version of Apache, use one of the following commands to install the plug-in:
    • Install the Apache HTTP Server plug-in module for Apache 2.2.x by adding the following line.

      LoadModule weblogic_module /home/myhome/weblogic-plugins-12.2.1.4.0/lib/mod_wl.so
      
    • Install the Apache HTTP Server plug-in module for Apache 2.4.x by adding the following line.

      LoadModule weblogic_module /home/myhome/weblogic-plugins-12.2.1.4.0/lib/mod_wl_24.so
      
  7. Verify the syntax of the httpd.conf file by running the following command:
    • UNIX/Linux

      > APACHE_HOME/bin/apachectl -t
      

    If the httpd.conf file contains any errors, the output of this command shows the errors; otherwise, the command returns the following:

    Syntax OK

Configure the Apache HTTP Server Plug-In

This section describes how to edit the httpd.conf file to proxy requests by path or by MIME type, to enable HTTP tunneling, and to use other Oracle WebLogic Server plug-in parameters.

Configuring the httpd.conf File

To configure the Apache HTTP Server plug-in, edit the httpd.conf file in your Apache HTTP Server installation. Complete the following tasks:

Task 1: Configure MIME Requests

You can proxy requests by MIME type and/or by path. Open the httpd.conf file in a text editor.

Note:

If both MIME type and proxying by path are enabled, proxying by path takes precedence over proxying by MIME type.

Configuring Proxy Requests by MIME Type

Follow these steps to configure MIME requests by MIME type in the httpd.conf file.

  1. Add an <IfModule> block that defines one of the following:
    • For a non-clustered WebLogic Server: define the WebLogicHost and WebLogicPort parameters.

    • For a cluster of WebLogic Servers: define the WebLogicCluster parameter.

    Example:

    <IfModule mod_weblogic.c>
     WebLogicHost myweblogic.example.com
     WebLogicPort 7001
     DebugConfigInfo ON
    </IfModule>
    
  2. Add a MatchExpression line to the <IfModule> block.

    For example, the following <IfModule> block for a non-clustered WebLogic Server specifies that all files with MIME type .jsp are proxied:

    <IfModule mod_weblogic.c>
     WebLogicHost my-weblogic.server.com
     WebLogicPort 7001
     MatchExpression *.jsp
     DebugConfigInfo ON
    </IfModule>
    

    You can also use multiple MatchExpressions, for example:

    <IfModule mod_weblogic.c>
     WebLogicHost my-weblogic.server.com
     WebLogicPort 7001
     MatchExpression *.jsp
     MatchExpression *.xyz
     DebugConfigInfo ON
    </IfModule>
    

    If you are proxying requests by MIME type to a cluster of WebLogic Servers, use the WebLogicCluster parameter instead of the WebLogicHost and WebLogicPort parameters. For example:

    <IfModule mod_weblogic.c>
     WebLogicCluster w1s1.com:7001,w1s2.com:7001,w1s3.com:7001
     MatchExpression *.jsp
     MatchExpression *.xyz
    </IfModule>
Configuring Proxy Requests by Path

Follow these steps to configure MIME requests by path in the httpd.conf file.

  1. Use the <Location> block and the WLSRequest statement to configure MIME requests by path. WLSRequest specifies the handler for the Oracle WebLogic Server Proxy Plug-In for Apache HTTP Server module. For example the following Location block proxies all requests containing /weblogic in the URL:
    <Location /weblogic>
    WLSRequest On
    PathTrim /weblogic
    </Location>
    
  2. Configure the PathTrim parameter inside the <Location> tag.

    The PathTrim parameter specifies a string trimmed from the beginning of the URL before the request is passed to the WebLogic Server instance (see General Parameters for Web Server Plug-Ins).

    These known issues arise when you configure the Oracle WebLogic Server Proxy Plug-In for Apache HTTP Server to use SSL

    • The following configuration is incorrect:

      <Location /weblogic>
       WLSRequest On 
      </Location> 
      
      <IfModule mod_weblogic.c>
       WebLogicHost localhost
       WebLogicPort 7001
       PathTrim /weblogic
      </IfModule> 
      

      The following configuration is correct:

      <Location /weblogic>
       WLSRequest On
       PathTrim /weblogic
      </Location>
      
    • The current implementation of the Oracle WebLogic Server Proxy Plug-In for Apache HTTP Server does not support the use of multiple certificate files with Apache SSL.

Task 2: Define Additional Parameters for Oracle WebLogic Server Proxy Plug-In

Define any additional parameters for the Oracle WebLogic Server Proxy Plug-In for Apache HTTP Server.

The Oracle WebLogic Server Proxy Plug-In for Apache HTTP Server recognizes the parameters listed in General Parameters for Web Server Plug-Ins. To modify the behavior of your Oracle WebLogic Server Proxy Plug-In for Apache HTTP Server, define these parameters either:

  • In a <Location> block, for parameters that apply to proxying by path, or

  • At global or virtual host scope, for parameters that apply to proxying by MIME type.

Task 3: Enable HTTP Tunneling (Optional)

You can enable HTTP tunneling for the t3 or IIOP protocols by configuring <Location> blocks.

  • To enable HTTP tunneling if you are using the t3 protocol and weblogic.jar, add the following <Location> block to the httpd.conf file:

    <Location /bea_wls_internal>
     WLSRequest On
    </Location>
    
  • To enable HTTP tunneling if you are using the IIOP, the only protocol used by the WebLogic Server thin client, wlclient.jar, add the following Location block to the httpd.conf file:

    <Location /bea_wls_internal>
     WLSRequest On
    </Location>
Task 4: Enable Web Services Atomic Transaction (Optional)
You can enable Web Services Atomic Transaction (WS-AT) by configuring the <Location> blocks. The <wls-wsat> parameter applies to proxying by path. You can optionally define the parameter to modify the behavior of your WebLogic Web Server Proxy Plug-In for Apache HTTP Server.
<Location /wls-wsat>
 WLSRequest On
</Location>

WebLogic web services enable interoperability with other external transaction processing systems, such as IBM WebSphere, JBoss, Microsoft .NET. For more information about Web Services Atomic Transaction (WS-AtomicTransaction), see https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=ws-tx.

Task 5: Verify and Apply Your Configuration

Follow these steps to verify your httpd.conf configuration and apply it to the Apache HTTP Server.

  1. Verify the syntax of the httpd.conf file by running the following command:
    • UNIX/Linux

      > APACHE_HOME/bin/apachectl -t
      

    If the httpd.conf file contains any errors, the output of this command shows the errors; otherwise, the command returns the following:

    Syntax OK
    
  2. Start the Apache HTTP Server.
    • UNIX/Linux

      > APACHE_HOME/bin/apachectl start
      
  3. Send a request to http://apache-host:apache-port/mywebapp/my.jsp from the browser. Validate the response.

Placing WebLogic Properties Inside Location or VirtualHost Blocks

If you choose to not use the <IfModule>, you can instead directly place the WebLogic properties inside Location or <VirtualHost> blocks. Consider the following examples of the <Location> and <VirtualHost> blocks:

<Location /weblogic>
WLSRequest On
WebLogicHost myweblogic.server.com
WebLogicPort 7001
</Location>
 
<Location /weblogic>
WLSRequest On
WebLogicCluster w1s1.com:7001,w1s2.com:7001,w1s3.com:7001
</Location>
 
<VirtualHost apachehost:80>
WLSRequest On
WebLogicServer weblogic.server.com
WebLogicPort 7001
</VirtualHost>

Example: Configuring the Apache Plug-In

This example demonstrates basic instructions for quickly setting up the Apache plug-in to proxy requests to a backend WebLogic Server.

  1. Make a copy of ${APACHE_HOME}/conf/httpd.conf file.
  2. Edit the file to add the following code:
    ... 
    LoadModule weblogic_module /home/myhome/weblogic-plugins-12.2.1/lib/mod_wl.so
    
    <IfModule mod_weblogic.c>
      WebLogicHost wls-host
      WebLogicPort wls-port
    </IfModule>
    
    <Location /mywebapp>
      WLSRequest On
    </Location>
    ...
    
  3. Include ${PLUGIN_HOME}/lib in the LD_LIBRARY_PATH by entering the following command:
     $ export LD_LIBRARY_PATH=/home/myhome/weblogic-plugin-12.2.1/lib:...
    

    Note:

    You can also update the LD_LIBRARY_PATH by copying the 'lib' contents to APACHE_HOME/lib or by editing the APACHE_HOME/bin/apachectl to update the LD_LIBRARY_PATH.

  4. At the prompt, start the Apache HTTP Server by entering:
    $ ${APACHE_HOME}/bin/apachectl start
    
  5. Send a request to http://apache-host:apache-port/mywebapp/my.jsp from the browser and validate the response

Including a weblogic.conf File in the httpd.conf File

To keep several separate configuration files, you can define parameters in a separate configuration file called weblogic.conf file, by using the Apache HTTP Server Include directive in an <IfModule> block in the httpd.conf file.

<IfModule mod_weblogic.c>
 # Config file for WebLogic Server that defines the parameters
 Include conf/weblogic.conf 
</IfModule>

The syntax of weblogic.conf files is the same as that for the httpd.conf file.

The following sections describe how to create weblogic.conf files, and include sample weblogic.conf files.

Rules for Creating weblogic.conf Files

Be aware of the following rules and best practices for constructing a weblogic.conf file.

  • Enter each parameter on a new line. Do not put "=" between a parameter and its value. For example:

    PARAM_1 value1
    PARAM_2 value2
    PARAM_3 value3
    
  • If a request matches both a MIME type specified in a MatchExpression in an <IfModule> block and a path specified in a Location block, the behavior specified by the <Location> block takes precedence.

  • If you use an Apache HTTP Server <VirtualHost> block, you must include all configuration parameters (MatchExpression, for example) for the virtual host within the <VirtualHost> block (see Apache Virtual Host documentation at http://httpd.apache.org/docs/vhosts/).

  • Sample httpd.conf file:

    <IfModule mod_weblogic.c>
     WebLogicCluster johndoe02:8005,johndoe:8006
     WLTempDir "c:\myTemp"
     DebugConfigInfo ON
     KeepAliveEnabled ON
     KeepAliveSecs 15
    </IfModule>
    
    <Location /jurl>
     WLSRequest On
     WebLogicCluster myCluster:7001
     WLTempDir "c:\jurl"
    </Location>
    
    <Location /web>
     WLSRequest On
     PathTrim /web
     WebLogicHost myhost
     WebLogicPort 8001
     WLTempDir "c:\web"
    </Location>
     <Location /foo>
     WLSRequest On
     WebLogicHost myhost02
     WebLogicPort 8090
     WLTempDir "c:\foo"
     PathTrim /foo
    </Location>
    
  • All the requests that match /jurl/* will have the POST data files in c:\jurl and will reverse proxy the request to agarwalp01 and port 7001. All the requests that match /web/* will have the POST data files in c:\web and will reverse proxy the request to myhost and port 8001. All the requests that match /foo/* will have the POST data files written to c:\foo and will reverse proxy the request to myhost02 and port 8090.

  • You should use the MatchExpression statement instead of the <Files> block.

Sample weblogic.conf Configuration Files

These examples of weblogic.conf files may be used as templates that you can modify to suit your environment and server. Lines beginning with # are comments.

Example Using WebLogic Clusters

# These parameters are common for all URLs which are 
# directed to the current module. If you want to override
# these parameters for each URL, you can set them again in
# the <Location> or <Files> blocks. 
<IfModule mod_weblogic.c>
 WebLogicCluster w1s1.com:7001,w1s2.com:7001,w1s3.com:7001
 ErrorPage http://myerrorpage.mydomain.com
 MatchExpression *.jsp
</IfModule>
####################################################
In the example, the MatchExpression parameter syntax for expressing the filename pattern, the WebLogic Server host to which HTTP requests should be forwarded, and various other parameters is as follows:
MatchExpression [filename pattern] [WebLogicHost=host] | [paramName=value]

The first MatchExpression parameter below specifies the filename pattern *.jsp, and then names the single WebLogicHost. The paramName=value combinations following the pipe symbol specify the port at which WebLogic Server is listening for connection requests, and also activate the Debug option. The second MatchExpression specifies the filename pattern *.html and identifies the WebLogic Cluster hosts and their ports. The paramName=value combination following the pipe symbol specifies the error page for the cluster.

Example Using Multiple WebLogic Clusters

# These parameters are common for all URLs which are 
# directed to the current module. If you want to override
# these parameters for each URL, you can set them again in
# the <Location> or <Files> blocks.
<IfModule mod_weblogic.c>
 MatchExpression *.jsp WebLogicHost=myHost|WebLogicPort=7001|Debug=ON
 MatchExpression *.html WebLogicCluster=myHost1:7282,myHost2:7283|ErrorPage=
 http://www.xyz.com/error.html
</IfModule>

Example Without WebLogic Clusters

# These parameters are common for all URLs which are 
# directed to the current module. If you want to override
# these parameters for each URL, you can set them again in
# the <Location> or <Files> blocks.
<IfModule mod_weblogic.c>
 WebLogicHost myweblogic.server.com
 WebLogicPort 7001
 MatchExpression *.jsp
</IfModule>

Example Configuring Multiple Name-Based Virtual Hosts

# VirtualHost1 = localhost:80
<VirtualHost 127.0.0.1:80>
DocumentRoot "C:/test/VirtualHost1"
ServerName localhost:80
<IfModule mod_weblogic.c> 
#... WLS parameter ...
WebLogicCluster localhost:7101,localhost:7201
# Example: MatchExpression *.jsp <some additional parameter>
MatchExpression *.jsp PathPrepend=/test2
</IfModule>
</VirtualHost>
 
# VirtualHost2 = 127.0.0.2:80
<VirtualHost 127.0.0.2:80>
DocumentRoot "C:/test/VirtualHost1"
ServerName 127.0.0.2:80
<IfModule mod_weblogic.c> 
#... WLS parameter ...
WebLogicCluster localhost:7101,localhost:7201
# Example: MatchExpression *.jsp <some additional parameter>
MatchExpression *.jsp PathPrepend=/test2
#... WLS parameter ...
</IfModule>
</VirtualHost>

You must define a unique value for ServerName or some plug-in parameters will not work as expected.

Template for the Apache HTTP Server httpd.conf File

This section contains a sample httpd.conf file for Apache HTTP Server. You can use this sample as a template and modify it to suit your environment and server. Lines beginning with # are comments.

Note:

Apache HTTP Server is not case sensitive.

Sample httpd.conf file for Apache HTTP Server

####################################################
# APACHE-HOME/conf/httpd.conf file
####################################################
LoadModule weblogic_module /home/myhome/weblogic-plugins-12.2.1/lib/mod_wl.so

<Location /weblogic>
 WLSRequest On
 PathTrim /weblogic
 ErrorPage http://myerrorpage1.mydomain.com
</Location>

<Location /servletimages>
 WLSRequest On
 PathTrim /something
 ErrorPage http://myerrorpage1.mydomain.com
</Location>

<IfModule mod_weblogic.c>
  MatchExpression *.jsp
  WebLogicCluster w1s1.com:7001,w1s2.com:7001,w1s3.com:7001
  ErrorPage http://myerrorpage.mydomain.com
</IfModule>

Understanding DMS Metrics for Apache HTTP Server Plug-in

You can configure and view DMS performance metrics for Apache HTTP Server. The Apache HTTP server provides the same set of DMS metrics as the Oracle WebLogic Server.

The DMS metrics that can be returned are described in DMS State Metrics, DMS Event Metrics, and DMS PhaseEvent Metrics.

This section contains the following information:

Configuring Metrics DMS Metrics for Apache HTTP Server Plug-in

To configure DMS metrics for the Apache HTTP Server, add the following code to the httpd.conf file.

# Add the following LoadModule only if it is not already present
# Use mod_wl.so for Apache httpd 2.2
LoadModule weblogic_module $PLUGIN_HOME/mod_wl_24.so 

<Location /metrics>
    SetHandler dms-handler
</Location>

Viewing Performance Metrics for Apache HTTP Server Plug-in

You can view the raw metrics using the URL:

http://apachehost:apacheport/metrics

where apachehost is the host name of the Apache server and apacheport is the port number.

The metrics that are coming from Oracle WebLogic Server plug-in can be found under the section /WebLogicProxy [type=OHSWebLogic].

Deprecated Directives for Apache HTTP Server

The WebLogic Server plug-in logs are now part of the Apache HTTP Server error log. References can be identified with the prefix weblogic: to easily identify them.

Apache 2.4 example:

[Thu May 14 23:15:05.160459 2015] [weblogic:debug] [pid 6571:tid 139894556022528] ApacheProxy.cpp(875): [client 10.184.61.77:53634] <657114316705052> =========New Request: [GET /weblogic/index.html HTTP/1.1] ======

Apache 2.2 example:

[Thu Apr 16 04:15:37 2015] [debug] ApacheProxy.cpp(873): [client 10.184.61.77] <2157714291829372> weblogic: ======New Request: [GET /weblogic/index.html HTTP/1.1] ======

The directives WLLogFile and Debug are deprecated. If the configuration uses these directives, the following note appears during startup:

[Thu May 14 23:22:19 2015] [warn] weblogic: The Debug directive is ignored.  The web server log level is used instead. 

To enable plug-in logs, set LogLevel to debug. The logs will be included in the file pointed to by the ErrorLog directive.