Apache2 Web Server Configuration on Linux

This document outlines the steps involved in setting up and configuring an integration of Apache2 and JBoss 5 on Red Hat Enterprise Linux 6.3.
For configuration on Windows refer to Apache2 Web Server Configuration on Windows.

Prerequisite: IFS Applications must be installed with JBoss Application Server.

NOTE: This guide contains steps to manually alter configuration files. It is best recommended that you backup such files prior to doing any alterations.

Steps 1 to 5 below have to be executed as user root. Steps 3 to 5 assume the SELinux system is enabled, which is by default on RHEL 6.3.

Step 1: Copy installer generated configuration file to Apache2 config directory

Copy generated by the IFS installer configuration file httpd-jboss.conf located in <ifs_home>/instance/<instance>/conf to Apache 2 configuration directory /etc/httpd/conf.d, e.g.:
cp /opt/ifs/instance/test/conf/apache/httpd-jboss.conf /etc/httpd/conf.d

Step 2: Install mod_jk module

Copy mod_jk.so module supplied together with the bundled JBoss AS, located in <ifs_home>/jboss-eap-5.1/jboss-as/native/lib64/httpd/modules to Apache 2 modules directory /etc/httpd/modules, e.g.:
cp /opt/ifs/jboss-eap-5.1/jboss-as/native/lib64/httpd/modules/mod_jk.so /etc/httpd/modules

Step 3: Set up grants to IFS log directory

Change the security context of <ifs_home>/instance/<instance>/logs directory to make it possible for Apache 2 to write its log files to this directory, e.g.:
chcon -R system_u:object_r:httpd_log_t:s0 /opt/ifs/instance/test/logs

Step 4: Set up grants to IFS config directory

Change the security context of <ifs_home>/instance/<instance>/conf/apache directory to make it possible for Apache 2 to read configuration files generated by the installer, e.g.:
chcon -R system_u:object_r:httpd_config_t:s0 /opt/ifs/instance/test/conf/apache

Step 5: Allow Apache 2 to access the network

Allow Apache 2 executable to access the network by running the following command:
setsebool -P httpd_can_network_connect 1

Step 6: Disable JBoss HTTP/1.1 Connector

Once the previous step is completed Apache 2 is ready to handle web requests. However the JBoss Web Server is also listening for HTTP requests. Since we have now setup Apache to handle the HTTP requests, the best is to disable the JBoss Web HTTP connector.

Locate the server.xml file in <ifs_home>\jboss-eap-5.1\jboss-as\server\<instance>\deploy\jbossweb.sar and either remove or comment out the following line.

<Connector address="${jboss.bind.address}" compressableMimeType="application/x-msdownload,application/octet-stream,application/xml,image/bmp,text/html,text/xml,text/plain" compression="on" connectionTimeout="20000" maxHttpHeaderSize="16384" port="8080" protocol="HTTP/1.1" redirectPort="8443" useSendfile="false"/>

Check if the following line is available in the server.xml as well, if not add it.

<Connector address="${jboss.bind.address}" port="8009" protocol="AJP/1.3" redirectPort="8443"/>