可以参考附件里面的配置进行修改。另请查阅更多配置资料。
一、要使Apache支持php
1、在httpd.conf最后一行增加如下代码:
# php5 support LoadModule php5_module D:/php5.6.16/php5apache2_4.dll AddType application/x-httpd-php .php .html .htm # configure thepath to php.ini PHPIniDir "D:/php5.6.16"
2、修改DirectoryIndex,默认是html,增加php,例如:
<IfModule dir_module> DirectoryIndex index.php index.htm index.html </IfModule>
3、php.ini配置不多说,无非是增加各种扩展extension,参考附件里面。
二、使用mod_proxy进行tomcat的集群配置
1、在httpd.conf里面,要一行一行的改,比较麻烦,不如就增加一句话,include,所有改动,放入另外一个新文件里面。在httpd.conf最后一行增加一行:
include "D:\Apache24\conf\mod_proxy.conf"
2、在同级目录创建mod_proxy.conf文件,写入如下内容:
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_ajp_module modules/mod_proxy_ajp.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_connect_module modules/mod_proxy_connect.so LoadModule proxy_ftp_module modules/mod_proxy_ftp.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule slotmem_shm_module modules/mod_slotmem_shm.so LoadModule socache_dbm_module modules/mod_socache_dbm.so LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so #虚拟机配置,负载均衡配置 <VirtualHost *:80> ServerName imweb.leihailong.com ServerAlias imweb.leihailong.com #小心,有些地方要有空格,要不然会出错哈哈。 ProxyPass / balancer://cluster/ stickysession=JSESSIONID|jsessionid nofailover=On ProxyPassReverse / balancer://cluster/ ErrorLog "logs/modproxy_error.log" CustomLog "logs/modproxy_access.log" common </VirtualHost> #The ProxyRequests directive should usually be set off when using ProxyPass. ProxyRequests Off <proxy balancer://cluster> BalancerMember ajp://192.168.2.254:8010 loadfactor=1 route=tomcat1 smax=5 max=20 ttl=120 retry=300 timeout=15 BalancerMember ajp://192.168.2.254:8011 loadfactor=1 route=tomcat2 smax=5 max=20 ttl=120 retry=300 timeout=15 # status=+H为配置热备,当所有机器都over时,才会请求该机器 #BalancerMember http://192.168.2.254:8080 status=+H ProxySet lbmethod=byrequests </proxy>
三、使用mod_jk进行tomcat的集群配置
1、在httpd.conf里面,要一行一行的改,比较麻烦,不如就增加一句话,include,所有改动,放入另外一个新文件里面。在httpd.conf最后一行增加一行:
include "D:\Apache24\conf\mod_jk.conf"
2、在同级目录创建mod_jk.conf文件,写入如下内容:
LoadModule jk_module modules/mod_jk.so JkWorkersFile conf/workers.properties JkMount /*.jsp controller JkLogFile logs/mod_jk.log JkLogLevel info JkLogStampformat "[%a %b %d %H:%M:%S %Y]"
3、在同级目录创建workers.properties,写入如下内容:
worker.list=controller #========tomcat1======== worker.tomcat1.port=8010 worker.tomcat1.host=localhost worker.tomcat1.type=ajp13 worker.tomcat1.lbfactor = 1 #========tomcat2======== worker.tomcat2.port=8011 worker.tomcat2.host=localhost worker.tomcat2.type=ajp13 worker.tomcat2.lbfactor = 1 #=======balance controller==== worker.controller.type=lb worker.retries=3 worker.controller.balance_workers=tomcat1,tomcat2 worker.controller.sticky_session=1
四、配置tomcat集群:
关键点:
1、端口号修改,避免重复,
2、jvmRoute="tomcat1" ,
3、<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
详细内容:
<?xml version='1.0' encoding='utf-8'?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- Note: A "Server" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/server.html --> <Server port="8006" shutdown="SHUTDOWN"> <!--APR library loader. Documentation at /docs/apr.html --> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --> <Listener className="org.apache.catalina.core.JasperListener" /> <!-- Prevent memory leaks due to use of particular java/javax APIs--> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html --> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <!-- Global JNDI resources Documentation at /docs/jndi-resources-howto.html --> <GlobalNamingResources> <!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users --> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <!-- A "Service" is a collection of one or more "Connectors" that share a single "Container" Note: A "Service" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/service.html --> <Service name="Catalina"> <!--The connectors can use a shared executor, you can define one or more named thread pools--> <!-- <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="150" minSpareThreads="4"/> --> <!-- A "Connector" represents an endpoint by which requests are received and responses are returned. Documentation at : Java HTTP Connector: /docs/config/http.html (blocking & non-blocking) Java AJP Connector: /docs/config/ajp.html APR (HTTP/AJP) Connector: /docs/apr.html Define a non-SSL HTTP/1.1 Connector on port 8080 --> <Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8444" /> <!-- A "Connector" using the shared thread pool--> <!-- <Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> --> <!-- Define a SSL HTTP/1.1 Connector on port 8443 This connector uses the JSSE configuration, when using APR, the connector should be using the OpenSSL style configuration described in the APR documentation --> <!-- <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> --> <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8010" protocol="AJP/1.3" redirectPort="8444" /> <!-- An Engine represents the entry point (within Catalina) that processes every request. The Engine implementation for Tomcat stand alone analyzes the HTTP headers included with the request, and passes them on to the appropriate Host (virtual host). Documentation at /docs/config/engine.html --> <!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1"> --> <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1"> <!--For clustering, please take a look at documentation at: /docs/cluster-howto.html (simple how to) /docs/config/cluster.html (reference documentation) --> <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> <!-- The request dumper valve dumps useful debugging information about the request and response data received and sent by Tomcat. Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.valves.RequestDumperValve"/> --> <!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> <!-- Define the default virtual host Note: XML Schema validation will not work with Xerces 2.2. --> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> --> <!-- Access log processes all example. Documentation at: /docs/config/valve.html --> <!-- <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/> <Context path="" docBase="D:/webapps" debug="0" reloadable="true" crossContext="true"/> --> </Host> </Engine> </Service> </Server>
相关推荐
通过以上步骤,我们可以在Windows XP环境下成功搭建一个集成了Apache、PHP、MySQL、Perl、Tomcat和Bind的服务集群。这种配置不仅适合于Web开发人员进行本地开发和测试,也可以作为小型企业的内部Web服务平台。值得...
Apache作为前端服务器,负责接收客户端请求并通过mod_jk模块转发给后端的Tomcat集群处理。这种方式不仅提高了系统的并发处理能力,还增强了系统的可靠性和扩展性。对于大型网站或高并发场景下的应用部署来说,这是一...
从给定的文件标题、描述、标签以及部分内容中,我们可以提炼出以下关键知识点,主要围绕Apache、Tomcat、MySQL、JSP与PHP共存环境的搭建,以及WebLogic集群配置等高级主题。以下是对这些知识点的详细阐述: ### 1. ...
本文将详细介绍TongWeb集群配置的过程,特别针对Apache2.0和Apache2.2版本的配置流程。 #### 二、集群配置步骤 ##### 1. 软件准备 在开始配置之前,需要确保具备以下软件环境: - **TongWeb4.6.9.0或以上版本**...
### Nginx+Apache+MySQL+PHP+Memcached+Squid 搭建门户网站 #### 一、前言与架构概述 随着互联网技术的发展,如何构建一个高效、稳定且能够应对高并发访问的Web服务器成为了许多企业和开发者关注的重点。本文将...
本压缩包提供了实现Tomcat集群配置所需的Apache服务器和mod_jk模块,具体版本为Apache 2.0.55和mod_jk-apache-2.0.55.so。 Apache HTTP Server是一个开源的Web服务器,它能够处理静态HTML文件和动态内容,如PHP、...
Apache 和 Tomcat 是两种广泛应用的 Web 服务器软件,它们在 Web 开发领域...在实际部署中,根据应用的需求,可以通过配置 Apache 和 Tomcat 的协同工作,优化性能和资源利用,以满足不同规模和复杂度的 Web 应用场景。
### 知识点详解:轻松配置 Linux 下的 Tomcat 集群 #### 1. 综述 本文旨在指导用户如何在 Linux 环境下配置一个具有高可用性、可扩展性以及具备负载均衡与错误恢复能力的 Tomcat 集群。 #### 1.1 目标 配置的最终...
在IT行业中,构建高效、可扩展的Web服务是至关重要的,Apache和Tomcat的集群配置、伪静态处理以及负载均衡正是实现这一目标的关键技术。Apache作为广泛应用的HTTP服务器,能够处理静态内容,而Tomcat则作为Java应用...
5. **Cluster**: 支持集群配置,提供高可用性和负载均衡。 **安装与配置** 安装Apache Tomcat 6.0通常包括解压下载的`apache-tomcat-6.0.33`压缩包,设置环境变量如`CATALINA_HOME`,以及配置`conf/server.xml`文件...
本文将深入探讨如何在CentOS上安装Nginx服务,并配置PHP和Tomcat集群,以及实现反向代理。 一、Nginx安装与配置 1. 更新系统: ``` sudo yum update -y ``` 2. 安装EPEL仓库: ``` sudo yum install epel-release...
首先,我们来看如何进行Tomcat集群配置。在集群中,每个Tomcat实例都是一个节点,它们之间通过共享session数据来协同工作。以下是一般的步骤: 1. **配置主从复制**:为了在节点间同步session,我们需要启用主从...
7. **集群与负载均衡**:高级用法中,Tomcat可以配置为集群,实现负载均衡和故障转移,提高应用的可用性和可伸缩性。 8. **与其他技术的整合**:Tomcat可以与Spring Boot、EJB、JMS、JNDI等其他Java技术集成,构建...
本文将详细介绍Apache的安装与配置过程,包括基本的安装步骤、代理设置以及如何构建高可用的集群。 1. **修改记录** 修改记录通常用于跟踪软件更新和改动,对于Apache服务器的维护来说,记录每次配置变更或版本...
本案例旨在实现一个基于Windows平台的NGINX与TOMCAT的负载均衡集群配置。具体而言,通过配置NGINX作为前端HTTP服务器,后端连接两个TOMCAT应用实例,以此达到负载均衡的效果。此外,还需要为整个系统设定Session超时...
#### 四、Apache与Tomcat 集群配置 在文档中还提到了Apache与Tomcat之间的连接配置,这部分主要涉及到Apache的mod_jk模块。 1. **mod_jk模块配置:** - `JkWorkersFile "e:\wamp\ConnApaTom\workers.properties"`...