---
title: "tomcat配置应用的方法"
author: "zybing"
date: "2010-11-04T10:41:37Z"
tags: ["Apache", "Tomcat", "Web", "XML", "配置管理"]
categories: ["编程语言"]
slug: "tomcat"
draft: false
lastmod: "2010-11-04T10:41:37Z"
id: 802490
url: "https://zybing.iteye.com/blog/802490"
---

在tomcat中，配置应用，可以有几种方法：

 

1.通过tomcat的管理界面进行配置；

 

2. 在${CATALINA\_HOME}/conf的server.xml中进行手工配置&lt;Context  ... /&gt;

 

3\. 将整个project打包成war，放在${CATALINA\_HOME}/webapps中，tomcat会自动解压加载

 

4\. 写一个xml文件，放在${CATALINA\_HOME}/Catalina/localhost中，xml示例：内容就是配置在server.xml中的&lt;Context ... &gt; 片段

```
<!--

    Context configuration file for the Tomcat Manager Web App

    $Id: manager.xml 303123 2004-08-26 17:03:35Z remm $

-->


<Context docBase="${catalina.home}/server/webapps/manager"
         privileged="true" antiResourceLocking="false" antiJARLocking="false">

  <!-- Link to the user database we will get roles from -->
  <ResourceLink name="users" global="UserDatabase"
                type="org.apache.catalina.UserDatabase"/>

</Context>
```