yum install httpd-2.2.3 rpm -q httpd
2. 增加module:mod_jk.so
wget http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.23/mod_jk-1.2.23-apache-2.2.x-linux-x86_64.so mv mod_jk-1.2.23-apache-2.2.x-linux-x86_64.so mod_jk.so mv mod_jk.so /usr/lib64/httpd/modules/mod_jk.so
3. 修改httpd.conf
sed -i '$a include /etc/httpd/conf/mod_jk.conf' /etc/httpd/conf/httpd.conf
4. 增加mod_jk.conf
# Load mod_jk module LoadModule jk_module /usr/lib64/httpd/modules/mod_jk.so # Where to find workers.properties JkWorkersFile /etc/httpd/conf/workers.properties # Where to put jk logs JkLogFile logs/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 ajp13 # JkMount /servlet/* ajp13 # Send JSPs for context /examples to worker named ajp13 JkMount /searcher/* searcher JkMount /jkmanager/* jkstatus
5. 增加workers.properties
###========worker.list======== worker.list=searcher,jkstatus ###========searcher======== worker.searcher.type=lb worker.searcher.method=B worker.searcher.balance_workers=searcher1,searcher2,searcher3 # *..* sticky_session=1.......sticky_session_force=1, .........worker.. worker.searcher.sticky_session=1 worker.searcher.sticky_session_force=0 worker.searcher1.port=8009 worker.searcher1.host=192.168.1.231 worker.searcher1.type=ajp13 worker.searcher1.lbfactor=1 worker.searcher2.port=8009 worker.searcher2.host=192.168.1.232 worker.searcher2.type=ajp13 worker.searcher2.lbfactor=1 worker.searcher3.port=8009 worker.searcher3.host=192.168.1.233 worker.searcher3.type=ajp13 worker.searcher3.lbfactor=1 ###=======jkstatus========== worker.jkstatus.type=status <Location /jkmanager/> JkMount jkstatus Order deny,allow Deny from all Allow from all </Location>
6. 启动httpd
/usr/sbin/httpd -k start
7. 通过http://$host/jkmanager查看apache状态