Advertisements
We have one Centos 5.2 32 bit vmware instance
IP : 192.168.137.65
Hostname : modjk.lap.work
Installing Apache:
#yum install httpd*
yum install gcc gcc-cpp gcc-c++
Because you will need httpd-devel for apxs
or
yum install httpd-devel
Start the apache service
/etc/init.d/httpd start
#Chkconfig httpd on
[root@modjk bin]# netstat -ntplau | grep httpd
tcp 0 0 :::80 :::* LISTEN 4948/httpd
[root@modjk bin]#
Installing Tomcat:
First install jdk
#wget http://download.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-i586.rpm
#rpm -ivh jdk-7u3-linux-i586.rpm
Set the following ernvironment variables:
JAVA_HOME=/usr/java/jdk1.7.0_03
export JAVA_HOME
PATH=$PATH:JAVA_HOME/bin
export PATH
You can add it in /etc/profile for permanent use
Download Tomcat:
#wget http://apache.mesi.com.ar/tomcat/tomcat-7/v7.0.26/bin/apache-tomcat-7.0.26.tar.gz
Untar the package:
tar xvzf apache-tomcat-7.0.26.tar.gz
cd apache-tomcat-7.0.26
cd bin
./startup.sh
[root@modjk bin]# netstat -ntplau
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 4823/portmap
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 5251/java
tcp 0 0 :::8009 :::* LISTEN 5251/java
tcp 0 0 :::8080 :::* LISTEN 5251/java
[root@modjk bin]#
Now install jakarta connector:
#wget http://archive.apache.org/dist/jakarta/tomcat-connectors/jk/source/jk-1.2.15/jakarta-tomcat-connectors-1.2.15-src.tar.gz
tar xvzf jakarta-tomcat-connectors-1.2.15-src.tar.gz
cd jakarta-tomcat-connectors-1.2.15-src
cd jk/
cd native/
./configure --with-apxs=/usr/sbin/apxs
make
make install
Add the mod_jk module to httpd configuration file
vi /etc/httpd/conf/httpd.conf
LoadModule jk_module modules/mod_jk.so
Save the file.
Now retart the apache service
/etc/init.d/httpd restart
Check the mod_jk is loaded
#httpd -M
Create worker.properties file
[root@modjk bin]# cat /etc/httpd/conf.d/workers.properties
workers.tomcat_home=/usr/local/src/apache-tomcat-7.0.26
workers.java_home=/usr/java/jdk1.7.0_03
ps=/
worker.list=worker1
worker.default.port=8009
worker.default.host=localhost
worker.default.type=ajp13
worker.default.lbfactor=1
[root@modjk bin]#
Create mod_jk.conf (apache conf file for mod_jk)
[root@modjk bin]# cat /etc/httpd/conf.d/mod_jk.conf
# Where to find workers.properties
JkWorkersFile /etc/httpd/conf.d/workers.properties
# Where to put jk logs
JkLogFile /var/log/httpd/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"
# Send servlet for context /examples to worker named worker1
JkMount /examples worker1
# Send JSPs for context /examples/* to worker named worker1
JkMount /examples/* worker1
[root@modjk bin]#
add the following line in /etc/httpd/conf/httpd.conf
Include /etc/httpd/conf.d/mod_jk.conf
Now restart the apache service
/etc/init.d/httpd restart
http://192.168.137.65 - You will get apache default page
http://192.168.137.65:8080 - You will get tomcat default page
http://192.168.137.65/examples - You will get tomcat examples page
Hi
ReplyDeletei m getting error in apache..plz check it..
[root@localhost conf.d]# /etc/init.d/httpd restart
Stopping httpd: [FAILED]
Starting httpd: Syntax error on line 2 of /etc/httpd/conf.d/mod_jk.conf:
JkWorkersFile only allowed once
You have declared JkWorkersFile more than once. May be you have declared it in httpd.conf and also in mod_jk.conf. Correct it and restart.
ReplyDeleteI m getting a 500 Internal Server Error message.
ReplyDeleteThe server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
I have two jboss listening on port 8080, when I login it redirects to the same 8443, in front have an apache with mod_jk, but listening on port 8080 just in time to log in the browser it returns to port 8443 and gives jboss error in the access, I am one week trying to fix it and I can not.
ReplyDeleteSorry my english
thanks