Sun Java System Application Server Enterprise Edition 8.1 2005Q2 High Availability Administration Guide

- Previous: Modifications to Sun Java System Web Server
- Next: Modifications to Microsoft IIS

## Using Apache Web Server

To use Apache Web Server, you must perform certain configuration steps before installing the load balancer plug-in. The load balancer plug-in installation also makes additional modifications to the Apache Web Server. After the plug-in is installed, you must perform additional configuration steps.

Note –

On Apache 1.3, when more than one Apache child processes runs, each process has its own load balancing round robin sequence. For example, if there are two Apache child processes running, and the load balancer plug-in load balances on to two application server instances, the first request is sent to instance #1 and the second request is also sent to instance #1. The third request is sent to instance #2 and the fourth request is sent to instance #2 again. This pattern is repeated (instance1, instance1, instance2, instance2, etc.)This behavior is different from what you might expect, that is, instance1, instance2, instance1, instance2, etc. In Sun Java System Application Server, the load balancer plug-in for Apache instantiates a load balancer instance for each Apache process, creating an independent load balancing sequence.

Apache 2.0 has multithreaded behavior if compiled with the `--with-mpm=worke`r option.

- Requirements for Using Apache Web Server

- Configuration before Installing the Load Balancer Plug-in

- Modifications Made by the Application Server Installer

- To configure Apache Security Files to work with the Load Balancer

### Requirements for Using Apache Web Server

For the Apache Web Server, your installation must meet the minimum requirements, depending on the version of Apache.

#### Requirements for Apache 1.3

With Apache 1.3, the load balancer plug-in requires:

- `openssl-0.9.7e` (source)

- `mod_ssl-2.8.16-1.3.`x (source), where x represents the version of Apache. The mod_ssl version must match the Apache version.

- `gcc-3.3-sol9-sparc-local` packages (for Solaris SPARC)

- `gcc-3.3-sol9-intel-local` packages (for Solaris x86)

- `flex-2.5.4a-sol9-sparc-local` packages (for Solaris SPARC)

- `flex-2.5.4a-sol9-intel-local` packages (for Solaris x86)

  The software sources are available at `http://www.sunfreeware.com`

  In addition, before compiling Apache:

- On the Linux platform, install Sun Java System Application Server on the same machine.

- On the Solaris operating system, ensure that `gcc` version 3.3 and `make` are in the `PATH`, and `flex` is installed.

- On the Solaris 10 operating system, before running `make` for OpenSSL, run `mkheaders`, located in `/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3/install-tools` on Solaris SPARC or `/usr/local/lib/gcc-lib/i386-pc-solaris2.9/3.3/install-tools` on Solaris x86.

- If you are using `gcc` on Red Hat Enterprise Linux Advanced Server 2.1, the version must be later than `gcc` 3.0.

Note –

To use C compiler other than `gcc`, set the path of the C compiler and make utility in the PATH environment variable. For example, with the `sh` shell: `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:appserver_installdir/lib`

#### Minimum Requirements for Apache 2

With Apache 2.0, the load balancer plug-in requires:

- `openssl-0.9.7e (source)`

- `httpd-2.0.49 (source)`

- `gcc-3.3-sol9-sparc-local` packages (for Solaris SPARC).

- `gcc-3.3-sol9-intel-local` packages (for Solaris x86)

- `flex-2.5.4a-sol9-sparc-local` packages (for Solaris SPARC)

- `flex-2.5.4a-sol9-intel-local` packages (for Solaris x86)

The software sources are available at `http://www.sunfreeware.com`

In addition, before compiling Apache:

- On the Linux platform, install Sun Java System Application Server on the same machine.

- On the Solaris operating system, ensure that `gcc` version 3.3 and `make` are in the `PATH`, and `flex` is installed.

- On the Solaris 10 operating system, before running `make` for OpenSSL, run `mkheaders`, located in `/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3/install-tools` on Solaris SPARC or `/usr/local/lib/gcc-lib/i386-pc-solaris2.9/3.3/install-tools` on Solaris x86.

- If you are using `gcc` on Red Hat Enterprise Linux Advanced Server 2.1, the version must be later than `gcc` 3.0.

Note –

To use a C compiler other than `gcc`, set the path of the C compiler and make utility in the PATH environment variable. For example, with the `sh` shell:`export LD_LIBRARY_PATH=` app_server_install_dir`/lib:$LD_LIBRARY_PATH`.

### Configuration before Installing the Load Balancer Plug-in

Before installing the load balancer plug-in for Apache, install the Apache Web Server. The Apache source must be compiled and built to run with SSL. This section describes the minimum requirements and high-level steps needed to successfully compile Apache Web Server to run the load balancer plug-in. These requirements and steps only apply to the Solaris and Linux versions of the software. For information on the Windows version of Apache, see the Apache web site.

#### To Install SSL-aware Apache

##### Before You Begin

You must have already downloaded and uncompressed the Apache software.

1. Download and unpack the OpenSSL source.

2. Compile and build OpenSSL.

   This step is not required on the Linux platform if OpenSSL 0.9.7.e is installed.

   Enter these commands:

       cd openssl-0.9.7e
       make
       make install

   For more information about OpenSSL, see the `http://www.openssl.org/`.

3. Follow one of these procedures, depending on the version of Apache:

   - For Apache 1.3, configure Apache with `mod_ssl` with the following steps:

     1. Unpack the `mod_ssl` source.

     2. `cd mod_ssl-2.8.14–1.3.x`

     3. `./configure –with-apache=../apache_1.3.x --with-ssl=../openssl-0.9.7e --prefix=install_path --enable-module=ssl --enable-shared=ssl --enable-rule=SHARED_CORE --enable-module=so`

     In the above commands, x is the Apache version number, and install_path is the directory in which to install Apache.

     For more information on `mod_ssl`, see `http://www.modssl.org`.

   - For Apache 2.0, configure the source tree:

     1. `cd http-2.0_` x.

     2. Run `./configure --with-ssl=` open_ssl_install_path `--prefix=` install_path `--enable-ssl --enable-so`

        In the above commands, x is the Apache version number, open_ssl_install_path is the directory where OpenSSL is installed, and install_path is the directory in which to install Apache.

4. For Apache on Linux 2.1, before compiling:

   1. Open `src/MakeFile` and find the end of the automatically generated section.

   2. Add the following lines after the first four lines after the automatically generated section:

          LIBS+= -licuuc -licui18n -lnspr4 -lpthread -lxerces-c
          -lsupport -lnsprwrap -lns-httpd40
          LDFLAGS+= -L/appserver_installdir/lib -L/opt/sun/private/lib

      Note that `-L/opt/sun/private/lib` is only required if you installed Application Server as part of a Java Enterprise System installation.

      For example:

          ## (End of automatically generated section)
          ##
          CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
          LIBS=$(EXTRA_LIBS) $(LIBS1)
          INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
          LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
          "LIBS+= -licuuc -licui18n -lnspr4 -lpthread
          -lxerces-c -lsupport -lnsprwrap -lns-httpd40
          LDFLAGS+= -L/appserver_installdir /lib -L/opt/sun/private/lib

   3. Set environment variable LD_LIBRARY_PATH.

      With all installations, set it to: `appserver_install_dir/lib`

      With Java Enterprise System Installations, set it to `appserver_install_dir/lib:opt/sun/private/lib` .

5. Compile Apache as described in the installation instructions for the version you are using.

   For more information, see the `http://httpd.apache.org/`

   In general the steps are:

   1. `make`

   2. `make certificate` (Apache 1.3 only)

   3. `make install`

      The command `make certificate` asks for a secure password. Remember this password as it is required for starting secure Apache.

6. Configure Apache for your environment.

### Modifications Made by the Application Server Installer

The load balancer plug-in installation program extracts the necessary files to a directory in the web server’s root directory:

- For Apache 1.3, the directory is `libexec`.

- For Apache 2.0, the directory is `modules` .

It adds the following entries to the web server instance’s `httpd.conf` file:

    <VirtualHost machine_name:443>
    ##Addition for EE lb-plugin
    LoadFile /usr/lib/libCstd.so.1
    LoadModule apachelbplugin_module libexec/mod_loadbalancer.so
    #AddModule mod_apachelbplugin.cpp
    <IfModule mod_apachelbplugin.cpp>
      config-file webserver_instance/conf/loadbalancer.xml
      locale en
    </IfModule>
    <VirtualHost machine_ip_address>
      DocumentRoot "webserver_instance/htdocs"
      ServerName server_name
    </VirtualHost>
    ##END EE LB Plugin ParametersVersion 7

### To configure Apache Security Files to work with the Load Balancer

Apache Web Server must have the correct security files to work well with the load balancer plug-in.

1. Create a directory called `sec_db_files` under apache_install_dir.

2. Copy application_server_domain_dir `/config/`*.db to apache_install_dir `/sec_db_files`.

3. Depending on the platform, perform additional configuration.

   - On the Solaris platform:

     Add the path `/usr/lib/mps/secv1` to LD_LIBRARY_PATH in the apache_install_dir`/bin/apachectl` script. The path must be added before `/usr/lib/mps`.

   - On Linux:

     Add the path `/opt/sun/private/lib` to LD_LIBRARY_PATH in the apache_install_dir`/bin/apachectl` script. The path must be added before `/usr/lib`.

   - On Microsoft Windows:

     1. Add a new path to the Path environment variable.

        Click Start->Settings->Control Panel->System->Advanced->Environment Variables->System Variables.

        Add application_server_install_dir `/bin` to the Path environment variable.

     2. Set the environment variable NSPR_NATIVE_THREADS_ONLY to 1.

        In the Environment Variables window, under System Variables, click New. Enter Variable name of NSPR_NATIVE_THREADS_ONLY and Variable value of 1.

     3. Restart the machine.

- Previous: Modifications to Sun Java System Web Server
- Next: Modifications to Microsoft IIS

- © 2010, Oracle Corporation and/or its affiliates