在Linux下配置apache2+mod_jk1.2.x+Jboss4.0.x:
一、apach官方网站下载apache2,下载完成后,放在/usr/local/下面(一般在这里),运行以下命令进行安装:
tar zxvf httpd
-
2.0
.
50
.tar.gz
//
将包解出;
. / configure - prefix =/ usr / local / apache2 - enable - so
make
make install
. / configure - prefix =/ usr / local / apache2 - enable - so
make
make install
-prefix后面为apache的安装路径,注意后面的参数一定要带上,否则配置不成功。
二、安装JDK 在java.sun.com下载J2SDK1.4, 安装方法同上,并在/etc/profile中加入以下几句,以设置JAVA_HOME和classpath环境变量:JAVA_HOME=/root/jdk_nb/jdk;export $JAVA_HOME PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
三、下载Mod_jk1.2.x 直接下载binaries 下载后改名为:mod_jk.so, 并拷到/usr/local/apache2/lib
四、安装Jboss4.0.x 安装方法同上
五、进行配置
1、配置Apache 的httpd.conf,位置:/usr/local/apache2/conf/ 在些文件中加入下面的信息
#
-------------
add
2006
-
03
-
07
-----------------------
#Load mod_jk
LoadModule jk_module lib / mod_jk.so
Configure mod_jk
JkWorkersFile conf / workers.properties
JkLogFile logs / mod_jk.log
JkLogLevel info
JkMount /** */ /** //*.jsp jboss1
JkMount /servlet/* jboss1
JkMount /application/* jboss1
#---------------- End ----------------------------
#Load mod_jk
LoadModule jk_module lib / mod_jk.so
Configure mod_jk
JkWorkersFile conf / workers.properties
JkLogFile logs / mod_jk.log
JkLogLevel info
JkMount /** */ /** //*.jsp jboss1
JkMount /servlet/* jboss1
JkMount /application/* jboss1
#---------------- End ----------------------------
也可以把这一段另外写在一个文件里
其中jboss1与下面的worker.propertis文件中的对应:
#
# workers.properties
#
# In Unix, we use forward slashes:
ps =/
# list the workers by name
worker.list = jboss1,jboss180
# ------------------------
# First jboss1 server
# ------------------------
worker.jboss1.port = 8009
worker.jboss1.host = 127.0 . 0.1
worker.jboss1.type = ajp13
# Specify the size of the open connection cache.
#worker.jboss1.cachesize
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
#worker.jboss1.lbfactor = 100
#
# END workers.properties
# workers.properties
#
# In Unix, we use forward slashes:
ps =/
# list the workers by name
worker.list = jboss1,jboss180
# ------------------------
# First jboss1 server
# ------------------------
worker.jboss1.port = 8009
worker.jboss1.host = 127.0 . 0.1
worker.jboss1.type = ajp13
# Specify the size of the open connection cache.
#worker.jboss1.cachesize
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
#worker.jboss1.lbfactor = 100
#
# END workers.properties
然后 cd /usr/local/apache2/bin
再运行 ./apachectl restart 即可
大家也可以看看在wiki里的相关介绍