Steps for configuring Apache with Jboss:

  1. Apache Installation:
  • Windows:
  • Linux:
    • Download the Apache webserver source from the website http://httpd.apache.org/download.cgi.
    • Once, the source had been downloaded, it needs to be extracted to some folder say “/usr/local/Apache” using the command gunzip <source zip>. This command will output a .tar file in the same folder.
    • Untar the .tar file using the command tar –xvf <source tar>.
    • This creates a new directory under the current directory with the source files.
    • Now, we need to configure the source files. To achieve this, we will execute a command called ./configure.
    • The next step is to build the source files. To build the source, execute the following commands sequentially.

                          make
make install

            Once these two commands gets executed successfully, a directory will be created under “/usr/local/apache2” and the Webserver config files and would have been copied to this directory.


  1. Apache webserver and JBoss Application server needs an interface to interact between themselves. The interface has been developed by Apache and is ready for download from their website http://tomcat.apache.org/connectors-doc/.
  2. mod_jk Connector Installation:
  • Windows:
  • Linux:
    • workers.tomcat_home            =D:Jboss
    • workers.java_home=C:Program FilesJavaJDK1.5
    • ps= for windows and ps=/ for linux
    • worker.list=<myproject>
    • worker.<myproject>.type=ajp13
    • worker.<myproject>.host=localhost
    • worker.<myproject>.port=8009

  1. Rename the downloaded connector file to mod_jk.so.
  2. Copy the mod_jk.so file to C:Program FilesApachemodules folder in windows and /usr/local/apache2/modules in linux.
  3. Create a file called worker.properties in the C:Program FilesApacheconf folder in windows and /usr/local/apache2/conf in linux.
  4. Update the worker.properties file with the following lines

            Where

                   D:Jboss = path where JBoss server is installed.

                  C:Program FilesJavaJDK1.5 = path where JDK is installed.

                  <myproject> = any user defined name.

  1. Append the below given lines at the end of an apache configuration file named httpd.conf which will be available under the folder C:Program FilesApacheconf for windows and /usr/local/apache2/conf for linux.
  • LoadModule jk_module modules/mod_jk.so
  • JkWorkersFile conf/worker.properties
  • JkLogFile logs/mod_jk.log
  • JkLogLevel error
  • JkRequestLogFormat “%w %V %T”
  • JkMount /* <myproject> (Make sure that the value which you assigned for worker.list in the worker.properties is specified here).
  1. Look out for the below given code in httpd.conf

<Directory />

            Options FollowSymLinks

            AllowOverride None

            Order deny, allow

            Deny from all                         

</Directory>

And change the last line Deny from all as Allow from all. After update, it should look like the one given below.

<Directory />

            Options FollowSymLinks

            AllowOverride None

            Order deny, allow

            Allow from all                        

</Directory>

  1. The configuration change mentioned in Step 11 is a must, because, if not updated, all the requests to access the resources of the JBoss server via the Apache server would return a Forbidden error (403).
  1. After making the configuration changes to the httpd.conf file, we can check whether the entries which were added in Step 8 and Step 9 are correct. To do so, please follow the steps given below.
  • Windows:

   Open up a command prompt and go to folder “C:Program FilesApachebin” and execute the following command   

                                                      httpd.exe –t

  • Linux:

    Open up a terminal and change to the folder “/usr/local/apache2/bin” and execute the following command

                        ./httpd -t

If it gives a message Syntax OK, then the content what we updated is correct. If not, review steps 8 and 9.

  1. Now, start the JBoss server and access the URL http://localhost:8080. This would display the JBoss Console.
  2. Start the Apache server and access the URL http://localhost. This would again, display the JBoss Console. If not, then please redo the previous steps.
  3. Now try accessing any of the deployed applications in JBoss via Apache using the URL http://localhost/${application}

Where

            ${application} = any deployed application in Jboss.

If the previous 2 steps are successful, then this step would render the page which you requested. If it fails, redo the previous steps.