安装Apache
以下是httpd 2.2的安装步骤(如使用httpd 2.4,请参考Linux下安装Apache HTTP Server 2.4):
1. 安装
下载解压后进入httpd的根目录,依次执行如下命令: # ./configure --prefix=PREFIX --enable-so --enable-mods-shared=most --enable-ssl
# make
# make install
安装完毕后可执行以下命令启动apache:
$ PREFIX/bin/apachectl start
注意:PREFIX要替换为Apache的安装目录,如/usr/local/apache2.2
2. 配置为service
将apachectl拷贝到init.d
# cp apachectl /etc/init.d/httpd
# chkconfig --add httpd
# chkconfig httpd on
# service httpd start
安装mod_jk
下载mod_jk, 解压后进入native目录,执行如下命令:
./configure --with-apxs=/usr/local/apache2.2/bin/apxs
make
编译成功后,进入native/apache-2.0目录,将mod_jk.so拷贝到Apache的modules目录下。
配置mod_jk
在Apache的conf目录中创建三个文件:mod-jk.conf、workers.properties、uriworkermap.properties,内容如下:
mod-jk.conf
# Load mod_jk module
# Update this path to match your modules location
LoadModule jk_module modules/mod_jk.so
# Declare the module for <IfModule directive>
#AddModule mod_jk.c
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile conf/workers.properties
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
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"
# Add shared memory.
# This directive is present with 1.2.10 and
# later versions of mod_jk, and is needed for
# for load balancing to work properly
JkShmFile logs/jk.shm
# You can use external file for mount points.
# It will be checked for updates each 60 seconds.
# The format of the file is: /url=worker
# /examples/*=loadbalancer
JkMountFile conf/uriworkermap.properties
# Add jkstatus for managing runtime data
<Location /jkstatus/>
JkMount status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
workers.properties
# Define list of workers that will be used
# for mapping requests
worker.list=loadbalancer,status
# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.reference=worker.template
worker.node1.host=192.168.50.1
worker.node1.port=8009
worker.node1.lbfactor=1
# Define Node2
# modify the host as your host IP or DNS name.
worker.node2.reference=worker.template
worker.node2.host=192.168.50.2
worker.node2.port=8009
worker.node2.lbfactor=2
worker.template.type=ajp13
worker.template.socket_connect_timeout=5000
worker.template.socket_keepalive=true
worker.template.connection_pool_minsize=0
worker.template.connection_pool_timeout=600
worker.template.ping_mode=A
# Load-balancing behaviour
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=node1,node2
worker.loadbalancer.sticky_session=true
# Status worker for managing load balancer
worker.status.type=status
uriworkermap.properties
/signac-web|/*=loadbalancer
#
# Mount jkstatus to /jkmanager
# For production servers you will need to
# secure the access to the /jkmanager url
#
/jkstatus=status
最后在httpd.conf文件中添加:
Include conf/mod-jk.conf
配置EAP
mod_jk使用AJP协议进行通讯,需在web subsystem中配置 ajp connector;
另外需配置jvmRoute,如未配置sticky_session是不起作用的。在EAP6中需添加属性instance-id="node1"(名称要与workers.properties中一致),如下:
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false" instance-id="node1">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>
....
</subsystem>
绑定ajp端口
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
...
<socket-binding name="ajp" port="8009"/>
<socket-binding name="http" port="8080"/>
....
</socket-binding-group>
测试
测试页面:
jkstatus: http://127.0.0.1/jkstatus
signac-web: http://127.0.0.1/signac-web
附录
1. 如使用YUM安装apache,需执行
yum install httpd
yum install httpd-devel
httpd-devel中包含apxs。
2. 安装apache, 执行./configure命令时,输出:
checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
原因是没有安装zlib包。centos下可执行yum install zlib-devel, ubuntu下可执行apt-get install zlib1g-dev来安装。
3. 启用ssl
yum install mod_ssl openssl
4. 升级openssl时注意使用--shared,否则可能会提示版本冲突
./config --prefix=/usr --shared
相关推荐
Jboss7 +apache 2.2.25+mod_jk 的配置集群 Jboss7 在windows下还没有看到有这块的文档 所以把写好的放上去和大家一志分享
本资源包含了文章Apache2.2.x + Tomcat6.x + JK 集群配置,http://blog.csdn.net/qq396229783/article/details/74295797里面所用到的软件配置
Jboss6+mod_jk+apache2.2集群配置,mod_jk方式的分布式集群方案。
英文文档 简单易懂 详细介绍了如何借助Apache2 mod_jk 1.2.x作为负载均衡搭建JBOSS集群 细分每个搭建步骤 文档内附带相关软件下载地址
网上讲的jboss集群大多出自同一人之手,各种复制粘贴,搞的我不得不自己研究,改进.
赠送jar包:jboss-annotations-api_1.3_spec-2.0.1.Final.jar; 赠送原API文档:jboss-annotations-api_1.3_spec-2.0.1.Final-javadoc.jar; 赠送源代码:jboss-annotations-api_1.3_spec-2.0.1.Final-sources.jar;...
myeclipse 远程调试jboss as7或者jboss eap6,包括windows运行环境和linux运行环境分别介绍,同时jboss as7和jboss eap6的配置也有所不同。
Jboss_as_7_官方_配置指南高清版
实现两个节点之间的无缝负载均衡,实时session复制,当一台机子的jboss的服务跨掉以后,自动会切换到另外一台服务器上面,对于用户的使用没有丝毫的影响。
java运行依赖jar包
使用Apache、mod_jk为负载均衡器的jboss集群详细配置
赠送jar包:jboss-websocket-api_1.1_spec-2.0.0.Final.jar; 赠送原API文档:jboss-websocket-api_1.1_spec-2.0.0.Final-javadoc.jar; 赠送源代码:jboss-websocket-api_1.1_spec-2.0.0.Final-sources.jar; 赠送...
赠送jar包:jboss-annotations-api_1.3_spec-2.0.1.Final.jar; 赠送原API文档:jboss-annotations-api_1.3_spec-2.0.1.Final-javadoc.jar; 赠送源代码:jboss-annotations-api_1.3_spec-2.0.1.Final-sources.jar;...
赠送jar包:jboss-websocket-api_1.1_spec-2.0.0.Final.jar; 赠送原API文档:jboss-websocket-api_1.1_spec-2.0.0.Final-javadoc.jar; 赠送源代码:jboss-websocket-api_1.1_spec-2.0.0.Final-sources.jar; 赠送...
jboss-eap-6.4.0.zip
redhat5+jboss4.2.3+apache2.2.19+mod_jk.so集群配置 文档中包括了jkd jboss apache mod_jk 的分别安装步骤,对linux不熟悉的人绝对有所帮助。 我把他搞定中途遇到了很多问题才写了这个文档,相对来说比较完善了,...
JBOSS EAP6安装部署手册 windows平台
压缩,使文件变小,与ZIP压缩机制完全相同。 包封装。能够让JAR包里面的文件依赖于统一版本的类文件。 可移植性,能够在各种平台上直接使用。 把一个JAR文件添加到系统的classpath环境变量之后,java通常会把这个...
jboss-transaction-api_1.1_spec-1.0.1.Final.jar包 描述: There is a new version for this artifact
jboss_EAP 部署在Window平台上