apache 2.2.3 与 tomcat 5.5.23整合

apache 2.2.3 与 tomcat 5.5.23整合

本文运用的是apache自带的ajp 模块


APACHE+TOMCAT
apacheweb+fapp+mobapp     172.18.3.101
apachemobile+fapp+mobapp  172.18.3.102
安装httpd-2.2.3.tar.gz软件包
安装路径:/usr/local/apache22
每台服务器安装了2个tomcat
主要的配置文件:
apache 的 /usr/local/apache22/conf/extra/httpd-vhosts.conf
tomcat 的 /opt/tomcat/conf/server.xml
                /opt/tomcat_mobile/conf/server.xml
安装步骤/方法:

1.安装apache(192.168.99.101,102,103,104,111,112,211)
tar jxf httpd-2.2.3.tar.bz2

./configure \
--prefix=/usr/local/apache22 \
--enable-mods-shared=all \
--enable-so \
--enable-proxy \
--enable-proxy_http=shared \
--enable-module=so \
--enable-mods-shared=all \
--enable-proxy-ajp=shared

make
make install

2.安装tomcat(192.168.99.121,122,123,211)
tar zxf apache-tomcat-5.5.23.tar.gz
mv apache-tomcat-5.5.23 /usr/local
ln -s /usr/local/apache-tomcat-5.5.23/ /opt/tomcat
c
tar zxf apache-tomcat-5.5.23.tar.gz
mv apache-tomcat-5.5.23 /usr/local/apache-tomcat-5.5.23_mobile
ln -s /usr/local/apache-tomcat-5.5.23_mobile/ /opt/tomcat_mobile

3.安装jdk(192.168.99.121,122,123,211)
./jdk-1_5_0_06-linux-i586.bin
mkdir /usr/java
mv jdk1.5.0_09 /usr/java/
ln -s /usr/java/jdk1.5.0_09/ /usr/local/jdk1.5
ln -s /usr/java/jdk1.5.0_09/ /opt/java

设置环境变量
vi /etc/profile
export JAVA_HOME=/usr/local/jdk1.5
export JRE=$JAVA_HOME/jre
export PATH=$JAVA_HOME/binPATH

front apache:
<VirtualHost 192.168.10.101:80>
    ServerName spotboard.mini-fx.tv
    ServerAlias dev.spotboard.mini-fx.tv mjwebgrp_a.mini-fx.tv.intranet
    ErrorLog logs/spotboard.mini-fx.tv-error_log
    CustomLog "|/usr/local/apache22/bin/rotatelogs /usr/local/apache22/logs/spotboard.mini-fx.tv.%Y%m%d 86400 540" combined
    DocumentRoot /usr/local/apache22/htdocs/jhf_pr_web
    <Directory /usr/local/apache22/htdocs/jhf_pr_web>
        Options FollowSymlinks
        Order allow,deny
        Allow from all
    </Directory>   
    ProxyPass /flash !
    ProxyPass /css !
    ProxyPass /images !
    ProxyPass /img !
    ProxyPass /lib !
    ProxyPass /extension !
    ProxyPass / balancer://spotboard/ stickysession=JSESSIONID lbmethod=byrequests maxattempts=1 nofailover=Off
    ProxyPassReverse / balancer://spotboard/
    ProxyRequests Off
    <roxy balancer://spotboard>
        BalancerMember ajp://192.168.10.41:8009 smax=2048 timeout=200 ttl=200 route=worker1
        BalancerMember ajp://192.168.10.42:8009 smax=2048 timeout=200 ttl=200 route=worker2
        BalancerMember ajp://192.168.10.43:8009 smax=2048 timeout=200 ttl=200 route=worker3
    </Proxy>
</VirtualHost>

mobile apache:
<VirtualHost 192.168.10.101:80>
    ServerName mb.mini-fx.tv
    ServerAlias dev.mb.mini-fx.tv mjwebgrp_a.mini-fx.tv.intranet
    ErrorLog logs/mb.mini-fx.tv-error_log
    CustomLog "|/usr/local/apache22/bin/rotatelogs /usr/local/apache22/logs/mb.mini-fx.tv.%Y%m%d 86400 540" combined
    DocumentRoot /usr/local/apache22/htdocs/jhf_pr_mobile
    <Directory /usr/local/apache22/htdocs/jhf_pr_mobile>
        Options FollowSymlinks
        Order allow,deny
        Allow from all
    </Directory>   
    ProxyPass /flash !
    ProxyPass /css !
    ProxyPass /images !
    ProxyPass /img !
    ProxyPass /lib !
    ProxyPass /extension !
    ProxyPass / balancer://mb/ stickysession=JSESSIONID lbmethod=byrequests maxattempts=1 nofailover=Off
    ProxyPassReverse / balancer://mb/
    ProxyRequests Off
    <roxy balancer://mb>
        BalancerMember ajp://192.168.24.41:8009 smax=2048 timeout=200 ttl=200 route=worker1
        BalancerMember ajp://192.168.24.42:8009 smax=2048 timeout=200 ttl=200 route=worker2
        BalancerMember ajp://192.168.24.43:8009 smax=2048 timeout=200 ttl=200 route=worker3
    </Proxy>
</VirtualHost>

admiin apache vhost:

NameVirtualHost 192.168.48.11:80

<VirtualHost 192.168.48.11:80>
    ServerName admin.mini-fx.tv
    ErrorLog logs/admin.mini-fx.tv-error_log
    CustomLog "|/usr/local/apache22/bin/rotatelogs /usr/local/apache22/logs/admin.mini-fx.tv.%Y%m%d 86400 540" combined
   ProxyPass / ajp://192.168.48.11:8009/ smax=1024 timeout=200 ttl=200 route=worker4
</VirtualHost>

admin tomcat:
      <Host name="admin.mini-fx.tv" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
        <Context path="" docBase="./jhf_pr_admin" debug="0" reloadable="false" />
      </Host>
文章挺好的,就是我太菜了,看得不是特明白!

能不能,把那10台服务器的逻辑拖布图给出来。再解释一下各自的功能。谢谢。
很想学习您的这套方案!