Komunikasi apache dan tomcat dengan mod-jk

Desember 19, 2008

Sebuah webserver apache identik dengan aplikasi web yang dibangun dengan menggunakan PHP. Hampir 80 % semua server hosting didunia menggunakan apache. Selain terkenal dengan open source apache juga stabil,aman apache juga mudah dalam maintenance.

Selain web server apache juga ada web server tomcat atau servlet. web server ini indentik dengan web yang dengan java platform.

Pada tulisan ini saya ingin menjelaskan komunikasi antara apache dengan tomcat. Tujuannya adalah aplikasi web diletakkan di pada server tomcat atau aplikasi web dibangun dengan java.

Dari sisi apache berfungsi sebagai virtual host untuk interface aplikasi web. sedang di sisi tomcat sebagai server aplikasi webnya.

Untuk dapat menggabungkan apache dan tomcat agar bisa bekerja sama – sama dapat menggunakan mod_jk. mod_jk merupakan modul java connectivity yang menggabungkan apache dan tomcat.

1. download mod_jk dari situs – situs terdekat

2. extract mod_jk.tar.gz

3. masuk ke direktori cd mod_jk/jk/native

4. compile

./configure --with-apxs=/usr/local/apache/bin/apxs --with-java-home=/usr/java/jdk
make
make install
5. buka file http.conf tambahkan baris berikut :
   LoadModule jk_module modules/mod_jk.so

6. buat file pada direktori /usr/local/apache2/conf/mod_jk.conf
7. Isikan content berikut pada file mod_jk.conf

JkWorkersFile /usr/local/apache2/conf/workers.properties
JkLogFile     /usr/local/apache2/log/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel    info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions     +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat     "%w %V %T"

8. buat file pada direktori /usr/local/apache2/workers.properties
9. Isikan file tersebuat dengan text berikut :

# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.reclycle_timeout=300

10. Membuat virtual host. Edit file httpd.conf tambahkan baris berikut

 <VirtualHost *:80>
       ServerName www.namadomain.com
       ServerAlias namadomain.com
       ErrorLog logs/namadomain.com-error_log
       CustomLog logs/namadomain.com-custom_log
       DocumentRoot /usr/local/apache-tomcat/webapps/aplikasi
       <Directory /usr/local/apache-tomcat/webapps/aplikasi>
          DirectoryIndex index.jsp
          Options Indexes FollowSymLinks
          AllowOverride All
          Order allow,deny
          allow from all
       </Directory>
      JkMount  /* worker1
</VirtualHost>

11. Restart kedua server apache dan tomcat

Entry Filed under: Server. .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Kalender

Desember 2008
S S R K J S M
    Feb »
1234567
891011121314
15161718192021
22232425262728
293031  

Kategori

About Me

Feed

Komentar Terakhir

nakula di Menjalankan/Mematikan service …
kandex di Membangun server LAMP
ekawidiarto di Memilih Framework PHP
Mas Agung di Menginstall Desktop KDE dan Gn…
Maxmixmatch di * Restore Grub dan add list wi…

Blog Stats

SocialVibe


Blogroll

Pertalian