首 页 ┆ 源码下载 ┆ IT学院 ┆ 字体下载 ┆ 模板下载 ┆ 源码发布 ┆ 广告合作 ┆ 网站地图 ┆ 虚拟主机 ┆ 中文域名
► 设为首页
► 加入收藏
► 联系我们
源码下载 >> ASP源码 | PHP源码 | ASP.net源码 | JSP源码 | CGI源码 | VC/C++源码 | VB源码 | Delphi源码 | Flash源码
文章学院 >> 网络编程 | 网页设计 | 图形图象 | 数据库 | 服务器 | 网络媒体 | 网络安全 | 操作系统 | 办公软件 | 软件开发 | 黑客知识
字体下载 >> 精制字体 | 非英字体 | 艺术字体 | 著名字体 | 哥特式 | 简单字体 | 手写体 | 节假日 | 图案字体 | 精度像素 | 中文字体
模板下载 >> 企业门户 | 数码网络 | 休闲娱乐 | 影视音乐 | 旅游名胜 | 文化艺术 | 电子商务 | 个性展示 | 登陆导航 | Flash模板
►►您当前的位置:源码园 → IT学院 → 黑客知识 → 黑客入门 → 文章内容

TomCat 多虚拟站点配置--TomCat,虚拟,站点,配置

作者:佚名  来源:网上收集  发布时间:2006-4-29 19:28:32
在网络上找了许久,没有一个真正可以解决TomCat多虚拟站点的配置问题的,经过试验和参考官方网站资料,终于解决了这个问题.
  参考资料:Apache Tomcat文档/UpLoadFiles/NewsPhoto/\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
311
312         313               tempDir="/tmp/war-temp/"
314               deployDir="/tmp/war-deploy/"
315               watchDir="/tmp/war-listen/"
316               watchEnabled="false"/>
317    
318     -->
319
320
321
322    
328    
331
332    
338    
343
344    
352    
357             workDir="D:\WORKS\EShop\Tomcat\work\EWebShop">
358  

359      
360          xmlNamespaceAware="false">
361  
362  

363    

364  
365
366
367
368
  可以看到,这里修改了
  81行修改了两个参数值:          maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
          enableLookups="false" redirectPort="8443" acceptCount="100"
          connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="GB2312"/>
      修改port是修改Tomcat的服务端口,默认为8080,URIEncoding改为GB2312是为了使用中文路径
    但不建议使用.

  125行:

    192行:

  然后再添加360行开始的元素:    xmlValidation="false" xmlNamespaceAware="false">
          workDir="D:\WORKS\YCOE\Tomcat\work\ycoe">

  这里是设置我们的第二个虚拟网站的域名.
  注:里面的内容并不是我们实际应用的,我们可以通过另一种比较方便而且容易修改的方式来设置这些参数.下面我们来做这方面的配置:
  1.在%CATALINA_HOME %\conf\Catalina目录下创建ycoe.vicp.net和yvor.vicp.net两个文件夹.
  2.在这两个文件夹里面创建ROOT.xml文件(要以ROOT.xml为名称,否则虽然不会出错,但不能用http://ycoe.vicp.net或http://yvor.vicp.net直接访问)
  3.ROOT.xml的内容如下:

workDir="D:\WORKS\EShop\Tomcat\work\EWebShop">


  根据自己的实际情况,设置这里的docBase 和workDir的路径.docBase是说明文档的路径,workDir是网站程序的路径,如果用相对路, 径,则是在%CATALINA_HOME %\webapp目录下,path是访问的路径

  参考官方文档:

Any XML file in the $CATALINA_HOME/conf/[engine_name]/[host_name] directory is assumed to contain a Context element (and its associated subelements) for a single web application. The docBase attribute of this element will typically be the absolute pathname to a web application directory, or the absolute pathname of a web application archive (WAR) file (which will not be expanded).
Any web application archive file within the application base (appBase) directory that does not have a corresponding directory of the same name (without the ".war" extension) will be automatically expanded, unless the unpackWARs property is set to false. If you redeploy an updated WAR file, be sure to delete the expanded directory when restarting Tomcat, so that the updated WAR file will be re-expanded (note that the auto deployer will automatically take care of this if it is enabled).
Any subdirectory within the application base directory that appears to be an unpacked web application (that is, it contains a /WEB-INF/web.xml file) will receive an automatically generated Context element, even if this directory is not mentioned in the conf/server.xml file. This generated Context entry will be configured according to the properties set in any DefaultContext element nested in this Host element. The context path for this deployed Context will be a slash character ("/") followed by the directory name, unless the directory name is ROOT, in which case the context path will be an empty string ("").

  你也可以在这两个目录下创建其它xml的文件

  但是这时你通过浏览器访问http://ycoe.vicp.net或http://yvor.vicp.net时并不能浏览到你的网页,因为它把这些网址解析到广域网上去了,除非你用域名绑定.
  为了让局域本机不把这两个网址解析到广域网上去.我们可以通过以下设置实现(Windows XP,其它操作系统没有试过):
 1.用文本编辑器打开C:\WINDOWS\system32\drivers\etc目录的hosts文件
 2.在内容最后另起一行,添加以下内容:
        127.0.0.1     ycoe.vicp.net
        127.0.0.1     yvor.vicp.net

  可以由上面的注释部分了解它的作用:


# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#     102.54.94.97   rhino.acme.com       # source server
#     38.25.63.10   x.acme.com         # x client host
  到这里,全部的配置已经完成了.重启Tomcat,打开http://ycoe.vicp.net或http://yvor.vicp.net就可以看到预期的效果了.呵呵
[] [返回上一页] [打 印]
  • 上一篇文章:SC介绍和教程--SC介绍和教程
  • 下一篇文章:黑客攻击技术之暴力破解法--黑客,攻击,技术,暴力,破解

  • 相关文章:
  • Tomcat配置技巧Top 10
  • 在linux7.1上安装jdk+tomcat+oracle9i 笔记
  • 在linux7.1上安装jdk+tomcat+oracle9i笔记
  • Apache与Tomcat安装配置手册
  • Apache+Tomcat实现Web服务(3)
  • Apache+Tomcat实现Web服务(2)
  • Apache+Tomcat实现Web服务(1)
  • TomCat 多虚拟站点配置--TomCat,虚拟,站点,配置
  • Tomcat全攻略--Tomcat,攻略
  • Tomcat漏洞利用--Tomcat,漏洞,利用
  • Tomcat中文手册(2)
  • Tomcat中文手册(1)
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 源码发布
Copyright © 2003-2009 Ymyasp.Com. All Rights Reserved .
备案序号:粤ICP备07029071号