`
jeasony
  • 浏览: 200019 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
社区版块
存档分类
最新评论

tomcat6虚拟机配置(faceye)

阅读更多

一直使用tomcat5,今天换用了tomcat6,没想到,tomcat6的虚拟主机配置,与tomcat5的有很多不同.

 在tomcat5下,经过配置,我一直使用http://localhost/来进行日常的开发调试工作.

换了tomcat6,想当然的在context.xml的host标签中加入context标记,没想到,

Tomcat6不认了,于是乎,去官方看文档,在官方有文档中,有这样的描述 :

 

Contexts are normally located underneath the appBase directory. For example, to deploy the foobar context as a war file in the ren host, use $CATALINA_HOME/renapps/foobar.war. Note that the default or ROOT context for ren would be deployed as $CATALINA_HOME/renapps/ROOT.war (WAR) or $CATALINA_HOME/renapps/ROOR (directory).

 

  意思也就是说,如果要配置成直接使用http://localhost/的方式进行访问,

要将war包命名为ROOT,同时根据文档:

 

Within your Context, create a META-INF directory and then place your Context definition in it in a file named context.xml. i.e. $CATALINA_HOME/renapps/ROOT/META-INF/context.xml This makes deployment easier, particularly if you're distributing a WAR file.

这样也就是说,在WEB-INF/META-INF下面,需要添加一个context.xml文件,这样做的主要目的一方面,是希望单独web应用的修改,不用重启tomcat服务器,就可以将新配置的修改 重新加载,另一方面,当然是希望各个应用的配置可以相互,隔离.

整个tomcat配置虚拟主机的官方文档在这里可以找到.

http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html

经过反复尝试,最终得如下步骤:

 1:修改/tomcat6/conf/server.xml

    主要修改为:

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

 

 这里的defaultHost 要与下面的 hostname 保持一致

name要与接下来创建的目录名一致

 

<Host name="localhost"  appBase="F:"WebDeploy"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">

  

其中,appBase指定了虚拟目录所在位置.

2.在/tomcat6/conf/下创建与"Engine"标签name属于指定值一致的目录名

   比如我使用的是Catalina,那么就创建名为Catalina的目录,其下创建名为localhost(与Host标签的name属性一致)的目录 .

3.在我们的应用下,在目录META-INF添加ROOT.xml,内容为:

<?xml version="1.0" encoding="UTF-8"?>
<Context path="" docBase="ROOT" debug="0" reloadable="true"></Context>

 

 

 整个配置完成,重启服务器.

tomcat官方对Engine标签的说明:

AttributeDescription
backgroundProcessorDelay

This value represents the delay in seconds between the invocation of the backgroundProcess method on this engine and its child containers, including all hosts and contexts. Child containers will not be invoked if their delay value is not negative (which would mean they are using their own processing thread). Setting this to a positive value will cause a thread to be spawn. After waiting the specified amount of time, the thread will invoke the backgroundProcess method on this engine and all its child containers. If not specified, the default value for this attribute is 10, which represent a 10 seconds delay.

className

Java class name of the implementation to use. This class must implement the org.apache.catalina.Engine interface. If not specified, the standard value (defined below) will be used.

defaultHost

The default host name, which identifies the Host that will process requests directed to host names on this server, but which are not configured in this configuration file. This name MUST match the name attributes of one of the Host elements nested immediately inside.

jvmRoute

Identifier which must be used in load balancing scenarios to enable session affinity. The identifier, which must be unique across all Tomcat 6 servers which participate in the cluster, will be appended to the generated session identifier, therefore allowing the front end proxy to always forward a particular session to the same Tomcat 6 instance.

name

Logical name of this Engine, used in log and error messages. When using muliple Service elements in the same Server, each Engine MUST be assigned a unique name.

 

tomcat 官方对Host标签的说明:

 

AttributeDescription
appBase

The Application Base directory for this virtual host. This is the pathname of a directory that may contain web applications to be deployed on this virtual host. You may specify an absolute pathname for this directory, or a pathname that is relative to the $CATALINA_BASE directory. See Automatic Application Deployment for more information on automatic recognition and deployment of web applications to be deployed automatically.

autoDeploy

This flag value indicates if new web applications, dropped in to the appBase directory while Tomcat is running, should be automatically deployed. The flag's value defaults to true. See Automatic Application Deployment for more information.

backgroundProcessorDelay

This value represents the delay in seconds between the invocation of the backgroundProcess method on this host and its child containers, including all contexts. Child containers will not be invoked if their delay value is not negative (which would mean they are using their own processing thread). Setting this to a positive value will cause a thread to be spawn. After waiting the specified amount of time, the thread will invoke the backgroundProcess method on this host and all its child containers. A host will use background processing to perform live web application deployment related tasks. If not specified, the default value for this attribute is -1, which means the host will rely on the background processing thread of its parent engine.

className

Java class name of the implementation to use. This class must implement the org.apache.catalina.Host interface. If not specified, the standard value (defined below) will be used.

deployOnStartup

This flag value indicates if web applications from this host should be automatically deployed by the host configurator. The flag's value defaults to true. See Automatic Application Deployment for more information.

name

Network name of this virtual host, as registered in your Domain Name Service server. One of the Hosts nested within an Engine MUST have a name that matches the defaultHost setting for that Engine. See Host Name Aliases for information on how to assign more than one network name to the same virtual host.

 

 最后,便可以通过http://localhost/进行访问了.

如果要添加其它应用,则将应用部署在appBase指定的目录,记得在应用的META-INF目录中添加"应用名.xml"就可以了.

当然,如:faceye.xml.那么,将来的访问就为:http://localhost/faceye.

分享到:
评论

相关推荐

    tomcat虚拟机配置

    标题中的“Tomcat虚拟机配置”指的是在Apache Tomcat服务器中设置多个独立的虚拟主机,以便在同一台服务器上运行多个不同的Web应用。Tomcat作为一款流行的开源Java Servlet容器,经常被用于开发和部署Web应用程序。...

    tomcat配置虚拟机

    详细讲解如何在tomcat下配置虚拟机,步骤详细,容易理解。

    Tomcat连接池配置.doc

    Tomcat 连接池配置详解 Tomcat 连接池配置是 Web 应用程序中一个非常重要的组件,它负责管理和维护数据库连接,确保数据访问的高速和安全性。本文将详细介绍 Tomcat 连接池配置的步骤和原理,帮助读者快速掌握 ...

    为Tomcat6配置数据源

    ### 为Tomcat6配置数据源 #### 一、配置文件概述 在为Tomcat6配置数据源之前,首先需要了解Tomcat6的配置文件结构。Tomcat6的配置文件主要位于`$TOMCAT6_HOME/conf`目录下,其中包括`server.xml`和`context.xml`两...

    apache2.2.11和tomcat6整合配置例子打包下载

    apache2.2.11和tomcat6整合配置例子打包下载,开发宝典...... apache2.2.11和tomcat6整合配置 1,下载mod_jk.so 2,在apache的httpd.conf里面加入下面的话 LoadModule jk_module modules/mod_jk.so JkWorkersFile "D:\...

    Tomcat安装和配置教程

    tomcat安装及配置教程Tomcat安装和配置教程Tomcat安装和配置教程Tomcat安装和配置教程Tomcat安装和配置教程Tomcat安装和配置教程Tomcat安装和配置教程Tomcat安装和配置教程Tomcat安装和配置教程Tomcat安装和配置教程...

    2024年Tomcat安装和配置(超详细)

    tomcat安装及配置教程**Tomcat安装及配置教程:2024年实用指南** **内容概要:** 本文为你提供了2024年最全面的Tomcat安装及配置教程,旨在帮助开发者掌握Java Web应用程序的部署和管理。内容包括Tomcat的基础概念、...

    基于tomcat的redis配置

    &lt;Manager className="com.orangefunction.tomcat6.redissessions.RedisSessionManager" host="appweb202" port="6381" database="0" maxInactiveInterval="1800"/&gt; appweb202:redias数据库对应的host port:redias...

    虚拟机配置+群集配置+tomcat服务器实现双机热备

    本教程将详细介绍如何通过虚拟机配置、群集设置以及Tomcat服务器实现双机热备,确保业务连续性和数据安全性。 首先,我们来看看“双机热备”这一概念。双机热备是一种高可用性解决方案,它通过两台或多台服务器互为...

    tomcat6跨域访问配置及jar包

    配置tomcat6的跨域访问问题,包含两个xml配置文件clientaccesspolicy.xml,crossdomain.xml,以及两个jar包cors-filter-1.7.1.jar,java-property-utils-1.9.1.jar

    虚拟机配置+群集配置+tomcat服务器实现双机热备文档

    虚拟机配置+群集配置+tomcat服务器实现双机热备文档

    安装JDK和tomcat环境变量配置

    安装 JDK 和 Tomcat 环境变量配置是 Java 开发环境的基础步骤,涉及到 JDK 和 Tomcat 的安装、环境变量的配置、Tomcat 的启动和测试。本文将详细介绍安装 JDK 和 Tomcat 环境变量配置的步骤和要点。 一、JDK 的安装...

    tomcat6下配置连接池

    内有关于tomcat6下如何配置数据库连接池的详细描述。。。。

    能用的tomcat6

    这个“能用的Tomcat6”指的是已经配置好并且可以正常运行的Tomcat版本6.0.41。 Tomcat6是基于Java EE 5规范的,它支持Servlet 2.5和JSP 2.1标准。对于开发者来说,Tomcat6具有轻量级、易于管理、速度快等优点,使得...

    liunx下tomcat、mysql配置

    liunx下tomcat、mysql配置!!liunx下tomcat、mysql配置!!liunx下tomcat、mysql配置!!

    如何配置Tomcat的JVM虚拟机内存大小

    ### 如何配置Tomcat的JVM虚拟机内存大小:深入解析与最佳实践 #### 引言 在IT领域,特别是Web应用服务器管理中,正确配置Java虚拟机(JVM)的内存大小对于确保应用程序的稳定性和性能至关重要。本文将详细探讨如何...

    Tomcat6 纯净版

    在使用Tomcat6纯净版时,用户可能需要自定义配置文件以满足特定的需求,例如调整服务器端口、设置用户访问权限、配置连接池等。此外,通过`manager`应用,管理员可以远程管理部署在Tomcat上的应用。为了安全起见,...

    tomcat6,用于idea适配低版本的tomcat

    标题中的“tomcat6”指的是Apache Tomcat 6,这是一个开源的应用服务器,主要用来部署和运行Java Servlet和JavaServer Pages(JSP)应用程序。在Java Web开发领域,Tomcat是应用最广泛的轻量级服务器之一,尤其对于...

    设置tomcat的jvm虚拟机大小

    6. Tomcat 配置文件:Tomcat 的配置文件包括 server.xml 和 catalina.bat/catalina.sh 文件。server.xml 文件用于配置 Tomcat 的连接器参数,而 catalina.bat/catalina.sh 文件用于设置 JVM 的启动参数。 7. Tomcat...

    idea tomcat 详细图文配置

    idea tomcat 详细图文配置 idea tomcat 详细图文配置idea tomcat 详细图文配置

Global site tag (gtag.js) - Google Analytics