Subject: Configure Apache mod_jk
Author: Linux
In response to: Install Apache mod_jk
Posted on: 10/21/2011 01:57:12 AM
1. Configure connector
$ sudo vi /etc/httpd/conf/workers.properties
# Define the list of workers that will be used
worker.list=worker1
# Define worker1
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
Save and close the file.
2. Configure httpd
# Load mod_jk module
LoadModule jk_module /usr/lib/httpd/modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile /etc/httpd/conf/workers.properties
# Where to put jk shared memory
JkShmFile /var/log/httpd/mod_jk.shm
# Where to put jk logs
JkLogFile /var/log/httpd/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# Send servlet for context /examples to worker named worker1
JkMount /examples/servlets/* worker1
# Exclude the static files
JkUnMount /examples/servlets/*.jpg worker1
JkUnMount /examples/servlets/*.gif worker1
# Send JSPs for context /examples to worker named worker1
JkMount /examples/*.jsp worker1
3. Configure httpd -- VirtualHost
<VirtualHost *:80>
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot /home/ec2-user/example2.com/html
SuexecUserGroup ec2-user ec2-user
<Directory /home/ec2-user/example2.com/html>
Options Indexes Includes FollowSymLinks
AllowOverride All
</Directory>
# Send servlet for context /examples to worker named worker1
JkMount /examples/servlets/* worker1
# Send JSPs for context /examples to worker named worker1
JkMount /examples/*.jsp worker1
</VirtualHost>
>
> On 10/21/2011 01:12:07 AM
Linux wrote:
------- --------
www.exmaple1.com ---| | | |
| | mod_jk | |
| httpd |------------| tomcat |
www.exmaple2.com ---| | | |
|_______| |________|
^ ^
| |
| |
static contents dynamical contents
1. Install httpd-devel
# yum install httpd-devel
2. Install all c/c++ complier and builder
# yum install gcc gcc-c++ libtool libxml2-devel
3. Download, make and install mod_jk
$ cd /home/ec2-user
$ mkdir mod_jk
$ cd mod_jk
$ curl http://apache.osuosl.org//tomcat/tomcat-connectors/jk/
tomcat-connectors-1.2.32-src.tar.gz > tomcat-connectors-1.2.32-src.tar.gz
$ tar xzf tomcat-connectors-1.2.32-src.tar.gz
$ cd tomcat-connectors-1.2.32-src/native
$ ./configure --with-apxs=/usr/sbin/apxs
$ make
$ sudo make install
References: