The Apache Tomcat Connectors (Installation of Mod_jk Tomcat COnnectors)
Installation of Mod_jk First you need to install the Prerequest!!
Pre-request
yum install -y httpd24-devel gcc gcc-c++ make libtool
yum install libtool httpd24-devel autoconf.noarch
OR
go to your terminal and use the below command
wget http://mirrors.estointernet.in/apache//httpd/httpd-2.4.38.tar.gz
tar -xzf httpd-2.4.38.tar.gz
Download the latest Apache from the Official Apache Website (https://httpd.apache.org/download.cgi)
Step:1
cd httpd-2.4.38
./configure --prefix=/usr/local/apache --enable-rewrite=shared --enable-proxy=shared
make
make install
Step:2
Install the JK connector (mod_jk) for tomcat Connectors
Now you can download tomcat connector (Mod_jk)
wget http://www.eu.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.46-src.tar.gz
Select the Latest which you Required.
Copy to this directory of /opt/
/opt/tomcat-connectors-1.2.46-src
Extract the Package which you donwload
tar -xvf tomcat-connectors-1.2.46-src.tar.gz
cd tomcat-connectors-1.2.46-src/
configure-make-make install the connector
./configure –with-apxs=/usr/bin/apxs
For UBUNTU ONLY THIS LINE(./configure --with-apxs=/usr/local/apache/bin/apxs)
make
libtool --finish /usr/lib64/httpd/modules
make install
service httpd restart
Step:3
Configuring the JK Connector Module
Create workers.properties file
Load and configure the JK connector module in apache httpd.conf file
GO to the Working directory path of /opt/tomcat-connectors-1.2.46-src/conf/
And open the worker.properties file (file path "/opt/tomcat-connectors-1.2.46-src/conf/workers.properties")
Put New entry in last paragh of
workers.tomcat_home=/opt/tomcat-connectors-1.2.46-src
workers.java_home=/usr/lib/jvm/jdk6
ps=/
worker.list=myworker
worker.myworker.port=8009
worker.myworker.host=localhost
worker.myworker.type=ajp13
worker.myworker.lbfactor=1
Step :4
Create the file of mod_jk.conf in the directory of "/etc/httpd/conf.d/mod_jk.conf" and put the entry .
LoadModule jk_module modules/mod_jk.so
JkWorkersFile /opt/tomcat-connectors-1.2.46-src/conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
Test the configuration are configured successfully .
httpd -t
Step:5
Apply the Virtual Host Concept
Open the path of /etc/httpd/conf.d/domain.example.com.conf
<VirtualHost *:80>
ServerName domain.example.com
DocumentRoot /var/www/vhosts/domain.example.com/public_html
CustomLog /var/www/vhosts/domain.example.com/statistics/logs/access_log combined
ErrorLog /var/www/vhosts/domain.eample.com/statistics/logs/error_log
<Directory /var/www/vhosts/domain.example.com/public_html>
Options -Includes +FollowSymLinks +MultiViews
AllowOverride All
Order allow,deny
Allow from al
</Directory>
JkMount /* myworker
</VirtualHost>
Restart the Tomcat and apache Httpd service
Thats it you done the Mod_jk Installation !!!.