Jboss5+Apache虚拟主机配置

tomcat-connectors-1.2.30

jdk-6u20

demo:  

安装: 

Httpd安装

tar -zxvf httpd-2.2.15.tar.gz

cd httpd-2.2.15

./configure --prefix=/usr/local/apache --enable-so --enable-track-vars --enable-mods-shared=all --enable-cache --enable-disk-cache --enable-mem-cache --enable-rewrite --with-mpm=worker

Make;make install

Jdk安装

chmod 755 jdk-6u20-linux-i586-rpm.bin

echo yes|./jdk-6u20-linux-i586-rpm.bin

vi /etc/profile

JAVA_HOME=/usr/java/jdk1.6.0_20

JRE_HOME=$JAVA_HOME/jre

PATH=$JAVA_HOME/bin:JRE_HOME/bin:$PATH

CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib

export JAVA_HOME JRE_HOME PATH CLASSPATH

. /etc/profile

Connectors安装

tar -zxvf tomcat-connectors-1.2.30-src.tar.gz

cd tomcat-connectors-1.2.30-src/native

./configure --with-apxs=/usr/local/apache/bin/apxs

make;make install

cd ../../

Jboss5.1GA安装并配置

unzip jboss-5.1.0.GA.zip

mv jboss-5.1.0.GA /usr/local

cd /usr/local

mv jboss-5.1.0.GA jboss

将/usr/local/jboss/server/default/deploy/jbossweb.sar/server.xml的

<Connector protocol="HTTP/1.1" port="8080" address="${ jboss.bind.address}"

connectionTimeout="20000" redirectPort="8443" />

修改为

<Connector protocol="HTTP/1.1" port="8080" address="${0.0.0.0}"

connectionTimeout="20000" redirectPort="8443" />

当然,不想要可以关掉,我们不用防问8080,因为我们的应用都会从8009走!

添加一个虚拟主机,具体如下:

</Host>

<Host>

<Valve className="org.jboss.web.tomcat.service.jca.CachedConnectionValve"

cachedConnectionManagerObjectName="jboss.jca:service=CachedConnectionManager"

transactionManagerObjectName="jboss:service=TransactionManager" />

</Host>

</Engine>

在/usr/local/jboss/server/default/deploy/装一个akin.war的目录,将demo.war放入其中,并解压!

jar -xvf demo.war

修改

WEB-INF/jboss-web.xml

<?xml version="1.0" encoding="UTF-8"?>

<jboss-web>

<context-root>/</context-root>   目录

<virtual-host></virtual-host>   虚拟的域名,和jboss server.xml文件对应

</jboss-web>

配置APACHE

Vi /usr/local/apache/conf/httpd.conf

增加打开默认页

<IfModule dir_module>

DirectoryIndex index.jsp index.html

</IfModule>

修改主目录防问权限

<Directory />

Options FollowSymLinks

AllowOverride None

Order allow,deny

allow from all

</Directory>

添加

LoadModule jk_module modules/mod_jk.so

Include conf/mod_jk.conf

Include conf/extra/httpd-vhosts.conf  //去除前面的#

Cd /usr/local/apache/conf

Vi mod_jk.conf

JkWorkersFile conf/workers.properties

JkLogFile logs/mod_jk.log

JkLogLevel info

JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

JkRequestLogFormat "%w %V %T"

JkMount /*.do worker1

JkMount /*.jsp worker1

Vi workers.properties

#Defining a worker named worker1 and of type ajp13

worker.list=worker1

#Set properties for worker1

worker.worker1.type=ajp13

worker.worker1.host=localhost

worker.worker1.port=8009

worker.worker1.lbfactor=50

worker.worker1.cachesize=10

worker.worker1.cache_timeout=600

worker.worker1.socket_keepalive=1

worker.worker1.socket_timeout=300

vi /usr/local/apache/conf/extra/httpd-vhosts.conf

<VirtualHost *:80>

ServerAdmin webmaster@inbelle.cn

DocumentRoot "/usr/local/jboss/server/default/deploy/akin.war"

ServerName

ServerAlias akin.com

ErrorLog "logs/akin.com-error_log"

CustomLog "logs/akin.com-access_log" common

JkMount /*.jsp worker1

</VirtualHost>

这样就完成了!

PS:刚开始建虚拟主机的时候,JSP是用文本写的,,不知道为什么就是死活不成,后来叫同事写了一个简单的,放上去就OK了,,怪事,!!这个就花了我一天!

这个搞定后,6的配置和5的一样,,就简单了,,4.2.3上面用文本写的JSP又可以用,郁闷之极!

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wywpdg.html