zoukankan      html  css  js  c++  java
  • 用apache配置多个tomcat webapp

    The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT.

         Apache Tomcat is the servlet container that is used in the official Reference Implementation for the java Servlet and JavaServer Pages technologies.

         apache2.2 和tomcat6到www.apache.org官方网站下载。

         tomcat 5 版本以后通过ajp13连接器(之前ajp12)与apache相连,tomcat ajp监控端口默认为8009。

         以tomcat6.0为例,需要以下步骤:

        从从tomcat.apache.org下载 连接器

    1    下载连接器文件:

    url(for win32): http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.26/mod_jk-1.2.26-httpd-2.2.4.so

    url(for linux):

    http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.26/x86_64/mod_jk-1.2.26-httpd-2.2.6.so

    2   将下载的so文件放置到apachDir/modules目录下

    3   在apacheDir/conf目录下新增workers.properties文件,并添加如下内容:

    ps=

    workers.tomcat_home=D:devtoolapache-tomcat-6.0.14

    workers.java_home=C:javajdk1.5.0_11

    worker.list=worker1,worker2

    worker.worker1.port=8009

    worker.worker1.host=127.0.0.1

    worker.worker1.type=ajp13

    worker.worker2.port=8009

    worker.worker2.host=127.0.0.1

    worker.worker2.type=ajp13

     该文件中定义了2个worker,对应2个web应用,这里只指向同一个tomcat,实际中可以指向不同的机器或不同的端口。

    3   修改apache的配置文件conf/httpd.conf:

    找到最后一个LoadModule ,在下面添加:

     LoadModule jk_module modules/mod_jk-1.2.26-httpd-2.2.4.so

    JkWorkersFile F:/Apache2.2/conf/workers2.proerties

    JkLogFile jklog.log

    # Set the jk log level [debug/error/info]

    JkLogLevel info

    # Select the timestamp log format

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

    # Send servlet for context /examples to worker named worker1

    # JkMount /examples/servlet/* worker1

    # Send JSPs  for context /examples to worker named worker1

    #example webapp

    JkMount  /examples/* worker1

    #statistic webapp

    JkMount  /statistic/* worker2

    至此,设置结束,

    重启apache,打开tomcat6

    我们试验一下效果 :打开浏览器,地址栏输入:http://localhost/examples/

  • 相关阅读:
    C++之用程序理解浅拷贝
    es6 | 新增语法 | 总结
    http协议 | http缓存
    Mobx | 强大的状态管理工具 | 可以用Mobx来替代掉redux
    nohup和&后台运行,进程查看及终止
    MIME Type介绍 Content-Type 各种定义
    Meta http-equiv属性详解(转)
    sublme text 3 快捷键
    【坑】【数组的坑】1、对象assign复制的假深度,2、数组slice复制的坑,3、还有数组map复制的坑
    Proxy监听对象的数据变化,处理绑定数据很有用
  • 原文地址:https://www.cnblogs.com/xxonehjh/p/3641980.html
Copyright © 2011-2022 走看看