[size=medium][b][color=indigo]1.安装Apache 2.2.x[/color][/b][/size]
安装过程略
[size=medium][b][color=indigo]2.下载mod_jk For Apache 2.2.x[/color][/b][/size]
下载mod_jk,[url]http://tomcat.apache.org/connectors-doc/[/url],注意版本号是否和Apache匹配,同时也要注意32位和64位的版本。
[size=medium][b][color=indigo]3.mod_jk的属性配置,workers.properties[/color][/b][/size]
cat /etc/httpd/conf/workers.properties
[size=medium][b][color=indigo]4.mod_jk的转发配置,uriworkermap.properties [/color][/b][/size]
cat /etc/httpd/conf/uriworkermap.properties
[size=medium][b][color=indigo]5.添加mod_jk配置文件[/color][/b][/size]
cat /etc/httpd/conf/mod_jk.conf
[size=medium][b][color=indigo]6.配置mod_jk[/color][/b][/size]
[list]
[*]复制mod_jk.conf到Apache的安装目录下的conf目录,如:/etc/httpd/conf/
[*]复制workers.properties到Apache的安装目录下的conf目录,如:/etc/httpd/conf/
[*]复制uriworkermap.properties到Apache的安装目录下的conf目录,如:/etc/httpd/conf/
[*]修改httpd.conf,找到Include的地方在前面添加:Include conf/mod_jk.conf
[/list]
[size=medium][b][color=indigo]7.配置mod_jk[/color][/b][/size]
安装过程略
httpd -version
Server version: Apache/2.2.3
Server built: Jul 15 2009 09:02:25
[size=medium][b][color=indigo]2.下载mod_jk For Apache 2.2.x[/color][/b][/size]
下载mod_jk,[url]http://tomcat.apache.org/connectors-doc/[/url],注意版本号是否和Apache匹配,同时也要注意32位和64位的版本。
[size=medium][b][color=indigo]3.mod_jk的属性配置,workers.properties[/color][/b][/size]
cat /etc/httpd/conf/workers.properties
#
worker.list=LoadBalancer,jkstatus
worker.jkstatus.type=status
# Now we define the load-balancing behaviour
worker.LoadBalancer.type=lb
#定义负载均衡节点
worker.LoadBalancer.balance_workers=node1,node2
#设置是否开启粘性会话共享,还需要设置JBOSS的UseJK和jvmRoute属性
worker.LoadBalancer.sticky_session=true
worker.LoadBalancer.method=R
worker.LoadBalancer.retries=2
#JBOSS的AJP端口
worker.node1.port=2081
worker.node1.host=localhost
worker.node1.type=ajp13
worker.node1.fail_on_status=500
worker.node1.cachesize=100
worker.node1.connection_pool_size=50
worker.node1.connection_pool_minsize=25
worker.node1.connection_pool_timeout=600
#JBOSS的AJP端口
worker.node2.port=2082
worker.node2.host=localhost
worker.node2.type=ajp13
worker.node2.fail_on_status=500
worker.node2.cachesize=100
worker.node2.connection_pool_size=50
worker.node2.connection_pool_minsize=25
worker.node2.connection_pool_timeout=600
[size=medium][b][color=indigo]4.mod_jk的转发配置,uriworkermap.properties [/color][/b][/size]
cat /etc/httpd/conf/uriworkermap.properties
/*=LoadBalancer
/=LoadBalancer
#
# Mount jkstatus to /jkmanager
# For production servers you will need to
# secure the access to the /jkmanager url
#
/jkmanager=jkstatus
[size=medium][b][color=indigo]5.添加mod_jk配置文件[/color][/b][/size]
cat /etc/httpd/conf/mod_jk.conf
# Load mod_jk module. Specify the filename
# of the mod_jk lib you’ve downloaded and
# installed in the previous section
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile conf/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel error
# 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"
[size=medium][b][color=indigo]6.配置mod_jk[/color][/b][/size]
[list]
[*]复制mod_jk.conf到Apache的安装目录下的conf目录,如:/etc/httpd/conf/
[*]复制workers.properties到Apache的安装目录下的conf目录,如:/etc/httpd/conf/
[*]复制uriworkermap.properties到Apache的安装目录下的conf目录,如:/etc/httpd/conf/
[*]修改httpd.conf,找到Include的地方在前面添加:Include conf/mod_jk.conf
[/list]
Include conf/mod_jk.conf
Include conf.d/*.conf
[size=medium][b][color=indigo]7.配置mod_jk[/color][/b][/size]