configuring apache with jboss
TRANSCRIPT
Configuring Apache with JbossThis document will provide the steps for configuring Apache webserver with Jboss. The configuration
steps mentioned in this document is written for Jboss application server running on Windows XP and
Linux platforms. For other operating systems, this may vary.
Steps for configuring Apache with Jboss:1. Apache Installation:
Windows:
Download the latest version of Apache Web Server from the website
http://httpd.apache.org/download.cgi
Install the binary to some folder say, “C:\Program Files\Apache\”.
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.
2. 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/.
3. mod_jk Connector Installation:
Windows:
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.
Linux:
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.
4. Rename the downloaded connector file to mod_jk.so.
5. Copy the mod_jk.so file to C:\Program Files\Apache\modules folder in windows and
/usr/local/apache2/modules in linux.
6. Create a file called worker.properties in the C:\Program Files\Apache\conf folder in
windows and /usr/local/apache2/conf in linux.
7. Update the worker.properties file with the following lines
workers.tomcat_home=D:\Jboss
workers.java_home=C:\Program Files\Java\JDK1.5
ps=\ for windows and ps=/ for linux
worker.list=<myproject>
worker.<myproject>.type=ajp13
worker.<myproject>.host=localhost
worker.<myproject>.port=8009
Where
D:\Jboss = path where JBoss server is installed.
C:\Program Files\Java\JDK1.5 = path where JDK is installed.
<myproject> = any user defined name.
8. 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 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 /* <myproject> (Make sure that the value which you assigned for
worker.list in the worker.properties is specified here).
9. Look out for the below given code in httpd.conf
<Directory />Options FollowSymLinksAllowOverride NoneOrder deny, allowDeny 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 FollowSymLinksAllowOverride NoneOrder deny, allowAllow from all
</Directory>
10. 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).
11. 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.
12. Now, start the JBoss server and access the URL http://localhost:8080. This would display the
JBoss Console.
13. 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.
14. 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.