Configuring Apache With Jboss
= any user defined name.
Steps for configuring Apache with Jboss:
- Apache Installation:
- Windows:
- Download the latest version of Apache Web Server from the websitehttp://httpd.apache.org/download.cgi
- Install the binary to some folder say, “C:\Program Files\Apache\”.
- Linux:
- Download the Apache webserver source from the websitehttp://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 . This command will output a .tar file in the same folder.
- Untar the .tar file using the command tar –xvf .
- 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
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.
- 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/.
- mod_jk Connector Installation:
- Windows:
- Linux:
- workers.tomcat_home =D:\Jboss
- workers.java_home=C:\Program Files\Java\JDK1.5
- ps=\ for windows and ps=/ for linux
- worker.list=
- worker.
.type=ajp13 - worker.
.host=localhost - worker.
.port=8009
Click on the link to download the latest connector for Windows platform mod_jk-1.2.28-httpd-2.2.3.so. This download will be applicable only for Win32 platforms.
Click on the link to download the latest connector for Linux platform mod_jk-1.2.28-httpd-2.2.X.so . This download will be applicable only for i586 processors.
- Rename the downloaded connector file to mod_jk.so.
- Copy the mod_jk.so file to C:\Program Files\Apache\modules folder in windows and/usr/local/apache2/modules in linux.
- Create a file called worker.properties in the C:\Program Files\Apache\conf folder in windows and /usr/local/apache2/conf in linux.
- Update the worker.properties file with the following lines
Where
D:\Jboss = path where JBoss server is installed.
C:\Program Files\Java\JDK1.5 = path where JDK is installed.
- Append the below given lines at the end of an apache configuration file named httpd.confwhich will be available under the folder C:\Program Files\Apache\conf 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 /*
(Make sure that the value which you assigned for worker.list in the worker.properties is specified here).
- Look out for the below given code in httpd.conf
Options FollowSymLinks
AllowOverride None
Order deny, allow
Deny from all
And change the last line Deny from all as Allow from all. After update, it should look like the one given below.
Options FollowSymLinks
AllowOverride None
Order deny, allow
Allow from all
- 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).
- 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 Files\Apache\bin” 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.
- Now, start the JBoss server and access the URL http://localhost:8080. This would display the JBoss Console.
- 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.
- Now try accessing any of the deployed applications in JBoss via Apache using the URLhttp://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.