Thursday, July 27, 2006

How to interact Apache-Tomcat with Apache-HTTP server

As a default, we can accessing Apache-Tomcat web server on port 8080. But, in a production server, Apache-Tomcat must be accessed on port 80.

Below are step-by-step to do that.

(1) Download mod_jk2.so from http://apache.cbn.net.id/tomcat/tomcat-connectors/jk2/binaries/ unzip and put file mod_jk2.so to the {APACHE_DIR}\modules directory

(2) Add this line below to the {APACHE_DIR}\conf\httpd.conf file

LoadModule jk2_module modules/mod_jk2.so

(3) Create a file workers2.properties and save to {APACHE_DIR}\conf

Below are the content file of workers2.properties :

[shm]
info=Scoreboard. Requried for reconfiguration and status with multiprocess servers.
file=anon

# Defines a load balancer named lb. Use even if you only have one machine.
[lb:lb]

# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1

# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
group=lb

# Map the Tomcat examples webapp to the Web server uri space
[uri:/examples/*]
group=lb

# Map the AR (Account Receivable Project) to the Web server uri space
[uri:/ar/*]
group=lb

[status:]
info=Status worker, displays runtime information

[uri:/jkstatus/*]
info=The Tomcat /jkstatus handler
group=status:


(4) Now, restart your Apache-Tomcat and Apache web server.

(5) Done.

No comments: