---
title: "tomcat 禁止用IP访问工程的配置"
author: "dream_ait"
date: "2015-12-24T17:34:36Z"
tags: []
categories: ["编程语言"]
slug: "tomcat-ip"
draft: false
lastmod: "2015-12-24T17:34:36Z"
id: 2266278
url: "https://ait.iteye.com/blog/2266278"
---

```xml


   <Host name=www.abc.com  appBase="webapps" <!-- 这个虚拟目录是你真实使用的虚拟目录，域名也是你指定的域名 -->
         unpackWARs="true" autoDeploy="true"
         xmlValidation="false" xmlNamespaceAware="false">
      <Context path="" docBase="/home/web/apache-tomcat-6.0.39/webapps/abc" debug="0" reloadable="true"/> <!-- 指定虚拟目录的项目地址 -->
      </Host>
   
      <Host name="192.168.1.1"  appBase="ipapps"   <!-- 设置你服务器的外网IP地址，并建立一个虚假的虚拟目录  ipaaps  这个是不存在的，当访问ＩＰ地址或其他域名，将被转向到访问这个虚拟目录上 -->
          unpackWARs="true" autoDeploy="true"
          xmlValidation="false" xmlNamespaceAware="false">
      </Host>


```