apache+tomcat 负载均衡搭建

本文详细介绍如何安装和配置Apache HTTP Server及Tomcat应用服务器,包括环境变量设置、监听端口配置、数据库连接等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

版本 apache: httpd-2.2.3.tar.gz

 

   tomcat:    apache-tomcat-5.5.12.tar.gz

 

   apache和tomcat 连接器: tomcat-connectors-1.2.26-src.tar.gz

tomcat安装

 

把tomcat 安装文件放到 /usr/local/目录下

解压tomcat    tar -xvf apache-tomcat-5.5.12.tar.gz

                     mv apache-tomcat-5.5.12 tomcat-5.5.12

                     修改server.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<Server>
  <Listener className="org.apache.catalina.core.AprLifecycleListener"/>
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
  <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
  <GlobalNamingResources>
    <Environment
      name="simpleValue"
      type="java.lang.Integer"
      value="30"/>
    <Resource
      auth="Container"
      description="User database that can be updated and saved"
      name="UserDatabase"
      type="org.apache.catalina.UserDatabase"
      pathname="conf/tomcat-users.xml"
      factory="org.apache.catalina.users.MemoryUserDatabaseFactory"/>
  </GlobalNamingResources>
  <Service
      name="Catalina">
    <Connector
        port="8080"
        redirectPort="8443"
        minSpareThreads="25"
        connectionTimeout="20000"
        maxSpareThreads="75"
        maxThreads="300"
        enableLookups="false"
        maxHttpHeaderSize="8192"
        URIEncoding="GBK"
        >
    </Connector>
    <Connector
        port="8009"
        redirectPort="8443"
        protocol="AJP/1.3">
    </Connector>
    <Engine
        defaultHost="localhost"
        name="Catalina">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
      <Host
          appBase="webapps"
          name="localhost">
           <Alias>www.xxxxx.cn</Alias>
           <Alias>www.xxxxxx.com.cn</Alias>
           <Alias>xxxxxx.com.cn</Alias>
           <Alias>xxxxx.cn</Alias>
        <Context
            crossContext="true"
            docBase="/xxx/xxx"
            path=""
            reloadable="true">
         
          <Resource
            removeAbandoned="true"
            removeAbandonedTimeout="60"
            logAbandoned="true"
            name="jdbc/xxxx" //jndi
            type="javax.sql.DataSource"
            driverClassName="org.gjt.mm.mysql.Driver"
            password="mysql"
            maxIdle="30"
            maxWait="10000"
            username="root"
            url="jdbc:mysql://localhost:3306/xxxx?autoReconnect=true"
            maxActive="2000"/>
        </Context>
      </Host>
    

    </Engine>
  </Service>
</Server>

 

 

 

 

apache 安装

tar -xvf httpd-2.2.3.tar.gz

cd httpd-2.2.3

./configure  --prefix=/usr/local/apache

make

make install

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值