13.5.2. Install the Mod_proxy HTTP Connector Into Apache HTTPD


mod_proxy is a load-balancing module provided by Apache. This task presents a basic configuration. For more advanced configuration, or additional details, refer to Apache's mod_proxy documentation at https://httpd.apache.org/docs/2.2/mod/mod_proxy.html. For more details about mod_proxy from the perspective of the JBoss Enterprise Application Platform, refer to Section 13.5.1, “About the Apache mod_proxy HTTP Connector” and Section 13.1.3, “Overview of HTTP Connectors”.


  • Either Enterprise Web Server HTTPD or Apache HTTPD needs to be installed. A standalone HTTPD is provided as a separate download in the Red Hat Customer Portal at https://access.redhat.com, in the JBoss Enterprise Application Platform 6 download area. Refer to Section 13.2.9, “Install the Apache HTTPD included with JBoss Enterprise Application Platform 6” for information about this HTTPD if you wish to use it.
  • The mod_proxy modules need to be installed. Apache HTTPD typically comes with the mod_proxy modules already included. This is the case on Red Hat Enterprise Linux, the HTTPD that comes with JBoss Enterprise Web Server, and the Apache HTTPD that comes with Microsoft Windows.
  • You need root or administrator privileges to modify the HTTPD configuration.
  • Determine the HTTPD configuration directory. This is the directory containing the conf/ and modules/ directories for Apache HTTPD. This will be referred to as HTTPD_CONF for the remainder of this task. Typical values include the following:
    • /etc/httpd/
    • EWS_HOME/httpd/, starting from where Enterprise Web Server is installed
  • JBoss Enterprise Application Platform must be configured with the HTTP or HTTPS web connector. This is part of the Web subsystem configuration. Refer to Section 13.2.2, “Configure the Web Subsystem” for information about configuring the Web subsystem.
  1. Enable the mod_proxy modules in the HTTPD

    Look for the following lines in your HTTPD_CONF/conf/httpd.conf file. If they are not present, add them to the bottom. If they are present but the lines begin with a comment (#) character, remove the character. Save the file afterward. Usually, the modules are already present and enabled.
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    # Uncomment these to proxy FTP or HTTPS
    #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
    #LoadModule proxy_connect_module modules/mod_proxy_connect.so
  2. Add a non-load-balancing proxy.

    Add the following configuration to your HTTPD_CONF/conf/httpd.conf file, directly beneath any other <VirtualHost> directives you may have. Replace the values with ones appropriate to your set-up.
    This example uses a virtual host. See the next step to use the default HTTPD configuration.
    <VirtualHost *:80>
    # Your domain name
    ServerName Domain_NAME_HERE
    ProxyPreserveHost On
    # The IP and port of the JBoss Enterprise Application Platform
    # These represent the default values, if your HTTPD is on the same host
    # as your JBoss Enterprise Application Platform managed domain or server
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
    # The location of the HTML files, and access control information
    DocumentRoot /var/www
    <Directory /var/www>
    Options -Indexes
    Order allow,deny
    Allow from all
    After making your changes, save the file.
  3. Add a load-balancing proxy.

    To use mod_proxy as a load balancer, and send work to multiple JBoss Enterprise Application Platform servers, add the following configuration to your HTTPD_CONF/conf/httpd.conf file.
    <Proxy balancer://mycluster>
    Order deny,allow
    Allow from all
    # Add each JBoss Enterprise Application Server by IP address and port.
    # If the route values are unique like this, one node will not fail over to the other.
    BalancerMember route=node1
    BalancerMember route=node2
    # Use the balancer as a single proxy, as in the <VirtualHost> example above.
    ProxyPass /://mycluster
    ProxyPassReverse /
    ProxyPassReverse /
    # Only proxy a specific application
    # ProxyPass /MyApp://mycluster
    # ProxyPassReverse /MyApp http://host3:8280/MyApp
    Starting the httpd ends with 
    Syntax error on line 1023 of /etc/httpd/conf/httpd.conf:
    ProxyPass|ProxyPassMatch needs a path when not defined in a location
    Ends with 
    Syntax error on line 1023 of /etc/httpd/conf/httpd.conf:
    ProxyPass|ProxyPassMatch needs a path when not defined in a location
    Start of Httpd without errors is expected.
    The examples above all communicate using the HTTP protocol. You can use AJP or HTTPS protocols instead, if you load the appropriate mod_proxy modules. Refer to the Apache mod_cluster documentation for more details.
  4. Enable sticky sessions.

    Sticky sessions mean that if a client request originally goes to a specific JBoss Enterprise Application Platform node, all future requests will be sent to the same node, unless the node becomes unavailable. This is almost always the correct behavior.
    To enable sticky sessions for mod_proxy, add the stickysession parameter to the ProxyPass statement. This example also shows some other parameters which you can use. Refer to Apache's mod_proxy documentation at http://httpd.apache.org/docs/2.2/mod/mod_proxy.html for more information on them.
    ProxyPass /MyApp balancer://mycluster stickysession=JSESSIONID lbmethod=bytraffic nofailover=Off
  5. Restart the HTTPD.

    Restart the HTTPD server for your changes to take effect.

Your HTTPD is configured to use mod_proxy to send client requests to JBoss Enterprise Application Platform servers or clusters, either in a standard or load-balancing configuration. To configure the JBoss Enterprise Application Platform to respond to these requests, refer to Section 13.2.11, “Configure the JBoss Enterprise Application Platform to Accept Requests From an External HTTPD”.