Linux 下Apache 和Tomcat 整合 mod_jk

apache-tomcat-7.0.6.tar.gz

httpd-2.2.17.tar.gz

jdk-6u23-linux-i586.bin

tomcat-connectors-1.2.31-src.tar.gz

1.安装httpd

tar zxvf httpd-2.2.17.tar.gz 
cd httpd-2.2.17 
./configure --prefix=/usr/local/apache2 --enable-so 
make && make install

2.安装JDK

chmod +x jdk-6u18-linux-i586.bin 
./jdk-6u18-linux-i586.bin 
mv jdk1.6.0_18 /usr/local/jdk 
rm -rf /usr/bin/java 
rm -rf /usr/bin/javac 
ln -s /usr/local/jdk/bin/java /usr/bin/java 
ln -s /usr/local/jdk/bin/javac /usr/bin/javac

[root@centoslamp src]# java -version 
java version "1.6.0_18" 
Java(TM) SE Runtime Environment (build 1.6.0_18-b07) 
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)

ln -s /usr/local/jdk/jre /usr/local/jre

设置环境变量

vi /etc/profile 添加如下内容

JAVA_HOME=/usr/local/jdk 
export JAVA_HOME 
JRE_HOME=/usr/local/jre 
export JRE_HOME

运行,使环境变量生效

source /etc/profile

3.安装tomcat

tar zxvf apache-tomcat-7.0.6.tar.gz 
mv apache-tomcat-7.0.6 /usr/local/tomcat

4.安装tomcat-connectors

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

cd tomcat-connectors-1.2.31-src/native/

  ./buildconf.sh

./configure --with-apxs=/usr/local/apache2/bin/apxs --with-java-home=/usr/local/jdk 
make && make install


tomcat connectors buildconf.sh

    博客分类:
  • 服务器
 
Java代码  
  1. rm autom4te.cache   
  2. libtoolize --force --automake --copy   
  3. ./buildconf.sh: line 7: libtoolize: command not found   
  4. aclocal   
  5. ./buildconf.sh: line 11: aclocal: command not found   
  6. autoheader   
  7. ./buildconf.sh: line 13: autoheader: command not found   
  8. automake -a --foreign --copy   
  9. ./buildconf.sh: line 15: automake: command not found   
  10. autoconf   
  11. ./buildconf.sh: line 17: autoconf: command not found   
  12. rm autom4te.cache  


Java代码
  1. yum -y install httpd-devel libtool automake  




5. 配置httpd.conf 文件

vi /usr/local/apache2/conf/httpd.conf

添加

LoadModule jk_module modules/mod_jk.so

<IfModule jk_module> 
JkWorkersFile conf/workers.properties 
JkMountFile conf/uriworkermap.properties 
JkLogFile logs/mod_jk.log 
JkLogLevel warn 
</IfModule>

6.创建并配置workers.properties文件

vi /usr/local/apache2/conf/workers.properties

worker.list=wlb , jkstatus 
worker.ajp13w.type=ajp13 
worker.ajp13w.host=localhost 
worker.ajp13w.port=8009 
worker.wlb.type=lb 
worker.wlb.balance_workers=ajp13w

worker.jkstatus.type=status

7.创建并配置uriworkermap.properties

vi /usr/local/apache2/conf/uriworkermap.properties

/admin/*=wlb 
/manager/*=wlb 
/jsp-examples/*=wlb 
/servlets-examples/*=wlb 
/examples/*=wlb 
/*.jsp=wlb 
!/servlets-examples/*.jpeg=wlb

/jkmanager=jkstatus

8.编辑server.xml文件

vi /usr/local/tomcat/conf/server.xml

在这个位置修改

<Host name="localhost"  appBase="webapps" 
            unpackWARs="true" autoDeploy="true">

<Host name="localhost"  appBase="webapps" 
            unpackWARs="true" autoDeploy="true" 
            xmlValidation="false" xmlNamespaceAware="false"> 
<Context path="" docBase="/usr/local/apache2/htdocs" debug="0"/>

 

9.在/usr/local/apache2/htdocs下创建测试文件test.jsp

vi /usr/local/apache2/htdocs/test.jsp

<% 
    System.out.println( "Evaluating date now" ); 
    java.util.Date date = new java.util.Date(); 
%> 
Hello!  The time is now <%= date %>

 

10.启动tomcat 和httpd 服务

[root@www src]# /usr/local/tomcat/bin/startup.sh 
Using CATALINA_BASE:   /usr/local/tomcat 
Using CATALINA_HOME:   /usr/local/tomcat 
Using CATALINA_TMPDIR: /usr/local/tomcat/temp 
Using JRE_HOME:        /usr/local/jre 
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar

/usr/local/apache2/bin/apachectl restart

11.测试

访问http://192.168.15.124/test.jsp 时输出

Hello! The time is now Sun Jan 30 13:55:23 CST 2011

http://192.168.15.124/jkmanager 可以查看状态

JK Status Manager for 192.168.15.124:80





configure: error: C++ preprocessor “/lib/cpp” fails sanity 错误的解决

 /lib/cpp fails sanity check的解决


在某些软件的时候,运行./configure 会报错,错误提示为:


configure: error: C++ preprocessor “/lib/cpp” fails sanity
check See `config.log’ for more details


解决办法:出现该情况是由于c++编译器的相关package没有安装,以root用户登陆,在终端上执行:


# yum install glibc-headers


# yum install gcc-c++




linux下apache tomcat mod_jk负载均衡



apache-tomcat-7.0.6.tar.gz
httpd-2.2.17.tar.gz
jdk-6u23-linux-i586.bin
tomcat-connectors-1.2.31-src.tar.gz
1个apache  2个tomcat在一台机器上,修改其中一个tomcat相关端口,对应如下
8080     8980
8005     8905
8009     8909
1.安装httpd
tar zxvf httpd-2.2.17.tar.gz 
cd httpd-2.2.17 
./configure --prefix=/usr/local/apache2 --enable-so 
make && make install
2.安装JDK
chmod +x jdk-6u18-linux-i586.bin 
./jdk-6u18-linux-i586.bin 
mv jdk1.6.0_18 /usr/local/jdk 
rm -rf /usr/bin/java 
rm -rf /usr/bin/javac 
ln -s /usr/local/jdk/bin/java /usr/bin/java 
ln -s /usr/local/jdk/bin/javac /usr/bin/javac
[root@centoslamp src]# java -version 
java version "1.6.0_18" 
Java(TM) SE Runtime Environment (build 1.6.0_18-b07) 
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)
ln -s /usr/local/jdk/jre /usr/local/jre
设置环境变量
vi /etc/profile 添加如下内容
JAVA_HOME=/usr/local/jdk 
export JAVA_HOME 
JRE_HOME=/usr/local/jre 
export JRE_HOME
运行,使环境变量生效
source /etc/profile
3.安装tomcat
tar zxvf apache-tomcat-7.0.6.tar.gz 
mv apache-tomcat-7.0.6 /usr/local/tomcat
tar zxvf apache-tomcat-7.0.6.tar.gz 
mv apache-tomcat-7.0.6 /usr/local/tomcat2
4.安装tomcat-connectors
tar zxvf tomcat-connectors-1.2.31-src.tar.gz
cd tomcat-connectors-1.2.31-src/native/
./configure --with-apxs=/usr/local/apache2/bin/apxs --with-java-home=/usr/local/jdk 
make && make install
5. 配置httpd.conf 文件
vi /usr/local/apache2/conf/httpd.conf
添加
LoadModule jk_module modules/mod_jk.so
<IfModule jk_module> 
JkWorkersFile conf/workers.properties 
JkMountFile conf/uriworkermap.properties 
JkLogFile logs/mod_jk.log 
JkLogLevel warn 
</IfModule>
6.创建并配置workers.properties文件
vi /usr/local/apache2/conf/workers.properties
worker.list=wlb , jkstatus
worker.worker1.port=8009 
worker.worker1.host=localhost 
worker.worker1.type=ajp13 
worker.worker1.lbfactor=1 
# Define preferred failover node for worker1 
#worker.worker1.redirect=worker2
worker.worker2.port=8909 
worker.worker2.host=localhost 
worker.worker2.type=ajp13 
worker.worker2.lbfactor=1 
# Disable worker2 for all requests except failover 
#worker.worker2.activation=disabled


worker.wlb.type=lb 
worker.wlb.balance_workers=worker1,worker2
worker.jkstatus.type=status
以上注释掉的两行如果开启,则worker2成为worker1的备用,在worker1不可用的情况下才会向worker2请求
7.创建并配置uriworkermap.properties
vi /usr/local/apache2/conf/uriworkermap.properties
/admin/*=wlb 
/manager/*=wlb 
/jsp-examples/*=wlb 
/servlets-examples/*=wlb 
/examples/*=wlb 
/*.jsp=wlb 
!/servlets-examples/*.jpeg=wlb
/jkmanager=jkstatus
!/*.gif=wlb 
!/*.jpg=wlb 
!/*.png=wlb 
!/*.css=wlb 
!/*.js=wlb 
!/*.htm=wlb 
!/*.html=wlb
8.编辑server.xml文件
vi /usr/local/tomcat/conf/server.xml
在这个位置修改
<Host name="localhost"  appBase="webapps" 
            unpackWARs="true" autoDeploy="true">
<Host name="localhost"  appBase="webapps" 
            unpackWARs="true" autoDeploy="true" 
            xmlValidation="false" xmlNamespaceAware="false"> 
<Context path="" docBase="/usr/local/apache2/htdocs" debug="0"/>
 
vi /usr/local/tomcat2/conf/server.xml
在这个位置修改
<Host name="localhost"  appBase="webapps" 
            unpackWARs="true" autoDeploy="true">
<Host name="localhost"  appBase="webapps" 
            unpackWARs="true" autoDeploy="true" 
            xmlValidation="false" xmlNamespaceAware="false"> 
<Context path="" docBase="/usr/local/apache2/htdocs" debug="0"/>
同时修改相关对应端口,如果在不同的机器上则不需要修改
<Connector port="8080" protocol="HTTP/1.1" 
             connectionTimeout="20000" 
             redirectPort="8443" /> 
  <!-- A "Connector" using the shared thread pool--> 
  <!-- 
  <Connector executor="tomcatThreadPool" 
             port="8080" protocol="HTTP/1.1" 
             connectionTimeout="20000" 
             redirectPort="8443" />
<Server port="8005" shutdown="SHUTDOWN">
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
 
9.在/usr/local/apache2/htdocs下创建测试文件test.jsp
vi /usr/local/apache2/htdocs/test.jsp
<% 
    System.out.println( "Evaluating date now" ); 
    java.util.Date date = new java.util.Date(); 
%> 
Hello!  The time is now <%= date %>
10.启动tomcat 和httpd 服务
[root@www src]# /usr/local/tomcat/bin/startup.sh 
Using CATALINA_BASE:   /usr/local/tomcat 
Using CATALINA_HOME:   /usr/local/tomcat 
Using CATALINA_TMPDIR: /usr/local/tomcat/temp 
Using JRE_HOME:        /usr/local/jre 
Using CLASSPATH:       /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
[root@www src]# /usr/local/tomcat2/bin/startup.sh 
/usr/local/apache2/bin/apachectl restart
11.测试
访问http://192.168.15.124/test.jsp 时输出
Hello! The time is now Sun Jan 30 13:55:23 CST 2011
http://192.168.15.124/jkmanager 可以查看状态,可以看到每次请求依次连接到每个tomcat上
JK Status Manager for 192.168.15.124:80






http://blog.csdn.net/ppzlyg/article/details/6170045




linux下apache tomcat mod_jk 负载均衡+集群+session 复制



apache-tomcat-7.0.6.tar.gz

httpd-2.2.17.tar.gz

jdk-6u23-linux-i586.bin

tomcat-connectors-1.2.31-src.tar.gz

1个apache  2个tomcat在一台机器上,修改其中一个tomcat相关端口,对应如下

8080     8980

8005     8905

8009     8909

4000     4001

1.安装httpd

tar zxvf httpd-2.2.17.tar.gz 
cd httpd-2.2.17 
./configure --prefix=/usr/local/apache2 --enable-so 
make && make install

2.安装JDK

chmod +x jdk-6u18-linux-i586.bin 
./jdk-6u18-linux-i586.bin 
mv jdk1.6.0_18 /usr/local/jdk 
rm -rf /usr/bin/java 
rm -rf /usr/bin/javac 
ln -s /usr/local/jdk/bin/java /usr/bin/java 
ln -s /usr/local/jdk/bin/javac /usr/bin/javac

[root@centoslamp src]# java -version 
java version "1.6.0_18" 
Java(TM) SE Runtime Environment (build 1.6.0_18-b07) 
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)

ln -s /usr/local/jdk/jre /usr/local/jre

设置环境变量

vi /etc/profile 添加如下内容

JAVA_HOME=/usr/local/jdk 
export JAVA_HOME 
JRE_HOME=/usr/local/jre 
export JRE_HOME

运行,使环境变量生效

source /etc/profile

3.安装tomcat

tar zxvf apache-tomcat-7.0.6.tar.gz 
mv apache-tomcat-7.0.6 /usr/local/tomcat1

tar zxvf apache-tomcat-7.0.6.tar.gz 
mv apache-tomcat-7.0.6 /usr/local/tomcat2

4.安装tomcat-connectors

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

cd tomcat-connectors-1.2.31-src/native/

./configure --with-apxs=/usr/local/apache2/bin/apxs --with-java-home=/usr/local/jdk 
make && make install

5. 配置httpd.conf 文件

vi /usr/local/apache2/conf/httpd.conf

添加

LoadModule jk_module modules/mod_jk.so

<IfModule jk_module> 
JkWorkersFile conf/workers.properties 
JkMountFile conf/uriworkermap.properties 
JkLogFile logs/mod_jk.log 
JkLogLevel warn 
</IfModule>

6.创建并配置workers.properties文件

vi /usr/local/apache2/conf/workers.properties

worker.list=wlb , jkstatus

worker.worker1.port=8009 
worker.worker1.host=localhost 
worker.worker1.type=ajp13 
worker.worker1.lbfactor=1 
# Define preferred failover node for worker1 
#worker.worker1.redirect=worker2

worker.worker2.port=8909 
worker.worker2.host=localhost 
worker.worker2.type=ajp13 
worker.worker2.lbfactor=1 
# Disable worker2 for all requests except failover 
#worker.worker2.activation=disabled

worker.wlb.type=lb 
worker.wlb.balance_workers=worker1,worker2

worker.jkstatus.type=status

以上注释掉的两行如果开启,则worker2成为worker1的备用,在worker1不可用的情况下才会向worker2请求

7.创建并配置uriworkermap.properties

vi /usr/local/apache2/conf/uriworkermap.properties

/admin/*=wlb 
/manager/*=wlb 
/jsp-examples/*=wlb 
/servlets-examples/*=wlb 
/examples/*=wlb 
/*.jsp=wlb 
!/servlets-examples/*.jpeg=wlb

/jkmanager=jkstatus

!/*.gif=wlb 
!/*.jpg=wlb 
!/*.png=wlb 
!/*.css=wlb 
!/*.js=wlb 
!/*.htm=wlb 
!/*.html=wlb

8.编辑server.xml文件

vi /usr/local/tomcat/conf/server.xml

修改相关对应端口,如果在不同的机器上则不需要修改

<Connector port="8080" protocol="HTTP/1.1" 
             connectionTimeout="20000" 
             redirectPort="8443" /> 
  <!-- A "Connector" using the shared thread pool--> 
  <!-- 
  <Connector executor="tomcatThreadPool" 
             port="8080" protocol="HTTP/1.1" 
             connectionTimeout="20000" 
             redirectPort="8443" />

 

<Server port="8005" shutdown="SHUTDOWN">

 

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

9.复制tomcat下webapps下的文件到/usr/local/apache2/htdocs

cp –R  /usr/local/tomcat1/webapps/* /usr/local/apache2/htdocs

10.启动tomcat 和httpd

/usr/local/tomcat1/bin/startup.sh

/usr/local/tomcat2/bin/startup.sh

/usr/local/apache2/bin/apachectl start

到这里负载均衡完成

配置集群

11.修改tomcat1 下的server.xml

<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker1">

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" 
                 channelSendOptions="8">

          <Manager className="org.apache.catalina.ha.session.DeltaManager" 
                   expireSessionsOnShutdown="false" 
                   notifyListenersOnReplication="true"/>

          <Channel className="org.apache.catalina.tribes.group.GroupChannel"> 
            <Membership className="org.apache.catalina.tribes.membership.McastService" 
                        address="228.0.0.4" 
                        port="45564" 
                        frequency="500" 
                        dropTime="3000"/> 
            <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" 
                      address="192.168.15.124" 
                      port="4000" 
                      autoBind="100" 
                      selectorTimeout="5000" 
                      maxThreads="6"/>

            <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter"> 
              <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/> 
            </Sender> 
            <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/> 
            <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/> 
          </Channel>

          <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" 
                 filter=""/> 
          <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>

<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer" 
                    tempDir="/tmp/war-temp/" 
                    deployDir="/tmp/war-deploy/" 
                    watchDir="/tmp/war-listen/" 
                    watchEnabled="false"/>

          <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/> 
          <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/> 
        </Cluster>

12.修改tomcat2的server.xml文件

<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker2">

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" 
                 channelSendOptions="8">

          <Manager className="org.apache.catalina.ha.session.DeltaManager" 
                   expireSessionsOnShutdown="false" 
                   notifyListenersOnReplication="true"/>

          <Channel className="org.apache.catalina.tribes.group.GroupChannel"> 
            <Membership className="org.apache.catalina.tribes.membership.McastService" 
                        address="228.0.0.4" 
                        port="45564" 
                        frequency="500" 
                        dropTime="3000"/> 
            <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" 
                      address="192.168.15.124" 
                      port="4001" 
                      autoBind="100" 
                      selectorTimeout="5000" 
                      maxThreads="6"/>

            <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter"> 
              <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/> 
            </Sender> 
            <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/> 
            <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/> 
          </Channel>

          <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" 
                 filter=""/> 
          <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>

<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer" 
                    tempDir="/tmp/war-temp/" 
                    deployDir="/tmp/war-deploy/" 
                    watchDir="/tmp/war-listen/" 
                    watchEnabled="false"/>

          <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/> 
          <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/> 
        </Cluster>

13.查看

netstat –ant

tcp        0      0 ::ffff:192.168.15.124:4000  :::*                        LISTEN      
tcp        0      0 ::ffff:192.168.15.124:4001  :::*                        LISTEN     

14.修改应用程序的web.xml文件

在</web-app> 之前加上<distributable/> 用于session 复制

vi /usr/local/tomcat2/webapps/examples/WEB-INF/web.xml

vi /usr/local/tomcat2/webapps/examples/WEB-INF/web.xml

vi /usr/local/apache2/htdocs/examples/WEB-INF/web.xml

<distributable/> 
</web-app>

15.测试session 复制

打开http://192.168.15.124/examples/servlets/servlet/SessionExample

输入相关内容,然后关闭其中的正在连接的tomcat 连接到第二个tomcat 查看之前提交的内容是否还在

Sessions Example
Session ID: A45E7C637D98B3EBDEF052BEADF8E5F4.worker2 
Created: Mon Jan 31 12:07:33 CST 2011 
Last Accessed: Mon Jan 31 12:09:26 CST 2011

The following data is in your session: 
1 = 1 
2 = 2

Sessions Example
Session ID: A45E7C637D98B3EBDEF052BEADF8E5F4.worker1 
Created: Mon Jan 31 12:07:33 CST 2011 
Last Accessed: Mon Jan 31 12:10:09 CST 2011

The following data is in your session: 
1 = 1 
2 = 2

 

相关文档

http://www.ibm.com/developerworks/cn/opensource/os-lo-apache-tomcat/

/usr/local/src/tomcat-connectors-1.2.31-src/conf/下的

httpd-jk.conf  uriworkermap.properties  workers.properties  workers.properties.minimal











apache tomcat 均衡负载技术 session复制

Apache Server + Tomcat 集成配置

java与.net的最大区别之一就是各种框架的配置过于复杂,而让许多程序员在此浪费大量时间,由于许多框架和技术都是开源的,所以文档的完整性也受到一定的考验。这些天因为一个项目的原因对apache和tomcat的集成配置进行研究,查遍了网上的文章都是一些乱七八糟的东西,可以看出版本没有几个,都是左抄右抄,鼠标点了几百遍,以为看到了希望,结果还是同一篇文章,问题依然没有解决,索性到apache的官方网站去看看,结果官方文档也是乱七八糟,版本不批配,有些旧的文档都没有及时的更新,让人摸不着头脑,现将我这两天来进行摸索终于配置成功的经验公开一下,望更多的程序员不要走弯路。
  为了简单起见,我这里使用的是最简配置,以便你尽快看到希望,关于更加复杂的配置可以根据自己需要进行研究,或邮件给我。 
  我使用的各软件版本如下: 
  Apache2.2 
  Tomcat-6.0.16 
  mod_jk-1.2.26-httpd-2.0.59.so 
  以上软件都可以在http://www.apache.org网站下载到,如有不知下载的可以与我联系。


  下面开始安装和配置: 
  1)安装Apache2.2到本机 
  2)解压Tomcat-6.0.16到本机 
  3)重命名mod_jk-1.2.26-httpd-2.0.59.so为mod_jk.so 
  4)拷贝mod_jk.so到Apache2.2安装目录下的modules目录 
  5)进入Apache2.2安装目录,进入conf目录,新建两个文件,分别为mod_jk.conf,workers.properties


  6)修改mod_jk.conf文件如下: 
    LoadModule  jk_module  modules/mod_bin.so #加载mod_jk.so 
    JkWorkersFile  conf/workers.properties 
    JkMount   /*.*  ajp13 #指定哪些请求交给tomcat处理 

  7)修改workers.properties文件如下: 
    workers.tomcat_home=D:/tomcat-6.0.16 #这是你的tomcat安装目录 
    workers.java_home=D:/jdk1.6.0_03 #这是你的jdk的目录 
    worker.list = ajp13 
    worker.ajp13.port=8009 #tomcat中ajp的端口 
    worker.ajp13.host=localhost #tomcat的主机地址 
    worker.ajp13.type=ajp13 
    worker.ajp13.lbfactor=1 #server的加权比重,值越高,分得的请求越多


  8)修改httpd.conf,在文件末尾追加内容如下: 
    include  "D:/Apache2.2/conf/mod_jk.conf" #此处填写你本机上的实际地址


  至此,Apache + Tomcat的配置完成,其实非常简单。 
  启动你的Tomcat,先访问http://localhost:8080,看你的Tomcat是否正常,再启动Apache Server,如果启动正常请访问http://localhost,如果同样出现tomcat主页,证明配置成功。


  如配置上出现问题请联系我。

http://tomcat.apache.org/connectors-doc/reference/apache.html

http://tomcat.apache.org/connectors-doc/reference/workers.html

出现的错误1

apache启动访问的时候出错

The attribute 'worker.controller.balanced_workers' is deprecated - please check 

tomcat 的 负载均衡 和session 复制 弄完了后检查 配置情况  在apache 的日志中发现了 出现了这个 警告

 mod_jk.log


The attribute 'worker.controller.balanced_workers' is deprecated - please check the documentation

仔细核对后 才发现  在网上 抄来的 东西就是不行   balanced_workers  中的 balanced 写错了

多了一个 d 应该为 balance_workers更正后重启apache 检查 log 发现一切正常。





http://wkm.iteye.com/blog/1457541


configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
yum -y install zlib-devel openssl-devel
debian:apt-get install zlib1g-dev


http://www.koven.org/archives/centos-5-configure-error.html
http://blueaeri.iteye.com/blog/572506
http://blog.csdn.net/lyjtynet/article/details/6008977
http://hi.baidu.com/ernest100/blog/item/47be2273b1e27b158701b0f7.html

http://hi.baidu.com/junchao2001/blog/item/515332d380a971063bf3cf50.html

http://wkm.iteye.com/blog/1457541

你可能感兴趣的:(java,apache,tomcat,linux,Interceptor,deprecated)