apache2与jboss的配置简单版
完全安装centos4.4server。
一、安装jre、jdk ;
#cd /usr/soft
#./
jdk-1_5_0_10-linux-i586-rpm.bin
#rpm –i jdk-1_5_0_10-linux-i586.rpm
#./
jre-1_5_0_10-linux-i586-rpm.bin
#rpm –i jre-1_5_0_10-linux-i586.rpm
#
vi /etc/profile
添加
##
export JAVA_HOME=/usr/java/jdk1.5.0_10
export
PATH=/usr/java/jdk1.5.0_10/binPATH
export
CLASSPATH=/usr/java/jdk1.5.0_10/lib/dt.jar:/usr/java/jdk1.5.0_10/lib.tools.jar
##
重启服务器;
二、已安装httpd-2.0.52-28.ent.centos4 并能运行
Httpd的安装目录为/etc/httpd
#
#/etc/init.d/httpd start | stop | restart
#which apxs
#
看返
回值:/usr/sbin/apxs
如果没有安装httpd-devel
三、安装jk1.2.14 ;
下载地址:
... k/source/jk-1.2.14/
jakarta-tomcat-connectors-1.2.14.1-src.tar.gz
放到 /usr/soft
运
行:
#
#cd /usr/soft
#tar zxvf
jakarta-tomcat-connectors-1.2.14.1-src.tar.gz
#cd
/usr/soft/jakarta-tomcat-connectors-1.2.14.1-src/jk/native/
#./configure
–with-apxs=/usr/sbin/apxs
#make
# cp ./apache-2.0/mod_jk.so
/etc/httpd/modules
#
修改 httpd.conf ;
#cd /etc/httpd/conf
#vi httpd.conf
##
StartServers 4
ServerLimit 24
ThreadLimit
128
MaxClients 3072
MinSpareThreads 100
MaxSpareThreads
200
ThreadsPerChild 128
MaxRequestsPerChild 0
##
在httpd.conf文件的最后一行加上:
Include conf/mod_jk2.conf
新建文件 mod_jk2.conf ;
#cd /etc/httpd/conf
# vi mod_jk2.conf
##
LoadModule
jk_module modules/mod_jk.so
JkWorkersFile conf/workers2.properties
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"
JkMount /* loadbalancer
#apache will serve the static picture.
##
新建文件
workers2.properties ;
#cd /etc/httpd/conf
#vi workers2.properties
##
# Define the first node...
worker.server105.port=8009
worker.server105.host=192.168.2.194
worker.server105.type=ajp13
worker.server105.lbfactor=1
#worker.server105.local_worker=1
worker.server105.cachesize=100
# Define the 2nd node...
#worker.server106.port=8009
#worker.server106.host=192.10.12.106
#worker.server106.type=ajp13
#worker.server106.lbfactor=1
##worker.server106.local_worker=1
#worker.server106.cachesize=100
# Now we define the load-balancing behaviour
worker.loadbalancer.type=lb
#worker.loadbalancer.balanced_workers=server105,server106
worker.loadbalancer.balanced_workers=server105
worker.loadbalancer.sticky_session=1
##
四、安装jboss ;
下载
jboss-4.0.5.GA.zip 到 /usr/local ;
运行:
#
#cd /usr/local
#unzip
jboss-4.0.5.GA.zip
# cd
/usr/local/jboss-4.0.5.GA/server/default/deploy/jbossweb-tomcat55.sar/META-INF
#vi
jboss-service.xml
找到 ;
##
Engine name="jboss.web" jmvRoute="Node1"
defaultHost="localhost" in server.xml.
##
修改为 ;
##
Engine
name="jboss.web" jmvRoute="server105" defaultHost="localhost" in
server.xml.
##
把工程
xxx.war 放到
/usr/local/jboss-4.0.5.GA/server/default/deploy/
下即可 ;
五、设置jboss的运行脚本,及设置开机启动 ;
在/etc/init.d/下新建一个文件jboss
##
#!/bin/sh
start(){
echo "Starting jboss.."
# If using an SELinux system such as RHEL 4, use the command
below
# instead of the "su":
# eval "runuser - jboss -c '/usr/local/jboss-4.0.5.GA/bin/run.sh
> /dev/null 2> /dev/null &'
# if the 'su -l ...' command fails (the -l flag is not recognized
by my su cmd) try:
#
sudo -u jboss /usr/local/jboss-4.0.5.GA/bin/run.sh >
/dev/null 2> /dev/null &
su -l root -c
'/usr/local/jboss-4.0.5.GA/bin/run.sh
>/dev/null 2> /dev/null &'
}
stop(){
echo "Stopping jboss.."
# If using an SELinux system such as RHEL 4, use the command
below
# instead of the "su":
# eval "runuser - jboss -c
'/usr/local/jboss-4.0.5.GA/bin/shutdown.sh -S &'
# if the 'su -l ...' command fails try:
#
sudo -u jboss /usr/local/jboss-4.0.5.GA/bin/shutdown.sh -S
&
su -l root -c '/usr/local/jboss-4.0.5.GA/bin/shutdown.sh -S &'
}
restart(){
stop
# give stuff some time to stop before we restart
sleep 60
# protect against any services that can't stop before
we restart (warning this kills all Java instances running as 'jboss'
user)
su -l root -c 'killall java'
# if the 'su -l ...' command fails
try:
#
sudo -u jboss killall java
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo
"Usage: jboss {start|stop|restart}"
exit 1
esac
exit 0
##
给jboss设属性,设置成可执行文件 ;
#cd /etc/init.d
#chmod 755 jboss
在/etc/rc.local 里添加 ;
##
/etc/init.d/jboss start
/etc/init.d/httpd
start
##
这样就可以开机启动
--------待修改。
阅读(1883) | 评论(0) | 转发(0) |