首页 | 资讯动态 | linux基础 | 系统管理 | 网络管理 | 编程开发 | linux数据库 | 服务器技术 | linux相关 | linux认证 | 嵌入式 | 下载中心 | 专题 | linux招聘 | 镜像站
OKLinux中文技术站
·设为首页
·加入收藏
·联系我们
系统管理: 中文环境 系统管理 桌面应用 内核技术 | Linux基础: 基础入门 安装配置 常用命令 经验技巧 软件应用 | Linux数据库: Mysql Postgre Oracle DB2 Sybase other
网络管理: 网络安全 网络应用 Linux服务器 环境配置 黑客安全 | 编程开发: PHP CC++ Python Perl Shell 嵌入式开发 java jsp | PHP技术: PHP基础 PHP技巧 PHP应用 PHP文摘
Linux资讯 Linux招聘 Linux专题 Apache | Linux相关: 硬件相关 Linux解决方案 Linux认证 企业应用 其它Unix | 相关下载: 资料下载 参考手册 开发工具 服务器类 软路由 其它
 技术搜索:
会员中心 注册会员 高级搜索  
  → 当前位置:首页>编程开发>java>java企业应用>正文

服务器及中间件:TomCat 多虚拟站点配置

http://www.oklinux.cn  2008-03-07  来源: 赛迪网 ycoe  会员收藏  游客收藏  【 】 

Engine元素中需要一个或多个Host元素,在Host元素里面,你必需有Context元素让网站应用程序与虚拟主机连接上,严密地说,每一个主机所关联的引擎必须有一个名字跟那个引擎默认的主机属性匹配 .
  可知,在Engine元素里面可以有多个Host,那么说,可以有在一个Engine里面设置多个服务器了,这正是我们需要的.每个Host元素里面要有一个Context元素.
  根据conf\server.xml里面的说明和范例,我样可以编写出下面一个配置文件:
我把配置文件全部粘出来了,但大部分都是默认的,还有注释部分。大可不理,只修改了几部分,后面都有说明!

1< !-- Example Server Configuration File
2< !-- Note that component elements are nested corresponding to their
3 parent-child relationships with each other
4
5< !-- A "Server" is a singleton element that represents the entire JVM,
6 which may contain one or more "Service" instances. The Server
7 listens for a shutdown command on the indicated port.
8
9 Note: A "Server" is not itself a "Container", so you may not
10 define subcomponents such as "Valves" or "Loggers" at this level.
11
12
13< Server port="8005" shutdown="SHUTDOWN">
14
15 < !-- Comment these entries out to disable JMX MBeans support used for the
16 administration web application
17 < Listener className="org.apache.catalina.core.AprLifecycleListener" />
18 < Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
19 < Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
20 < Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
21
22 < !-- Global JNDI resources
23 < GlobalNamingResources>
24
25 < !-- Test entry for demonstration purposes
26 < Environment name="simpleValue" type="java.lang.Integer" value="30"/>
27
28 < !-- Editable user database that can also be used by
29 UserDatabaseRealm to authenticate users
30 < Resource name="UserDatabase" auth="Container"
31 type="org.apache.catalina.UserDatabase"
32 description="User database that can be updated and saved"
33 factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
34 pathname="conf/tomcat-users.xml" />
35
36 < /GlobalNamingResources>
37
38 < !-- A "Service" is a collection of one or more "Connectors" that share
39 a single "Container" (and therefore the web applications visible
40 within that Container). Normally, that Container is an "Engine",
41 but this is not required.
42
43 Note: A "Service" is not itself a "Container", so you may not
44 define subcomponents such as "Valves" or "Loggers" at this level.
45
46
47 < !-- Define the Tomcat Stand-Alone Service
48 < Service name="Catalina">
49
50 < !-- A "Connector" represents an endpoint by which requests are received
51 and responses are returned. Each Connector passes requests on to the
52 associated "Container" (normally an Engine) for processing.
53
54 By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
55 You can also enable an SSL HTTP/1.1 Connector on port 8443 by
56 following the instructions below and uncommenting the second Connector
57 entry. SSL support requires the following steps (see the SSL Config
58 HOWTO in the Tomcat 5 documentation bundle for more detailed
59 instructions):
60 * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
61 later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
62 * Execute:
63 %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
64 $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
65 with a password value of "changeit" for both the certificate and
66 the keystore itself.
67
68 By default, DNS lookups are enabled when a web application calls
69 request.getRemoteHost(). This can have an adverse impact on
70 performance, so you can disable it by setting the
71 "enableLookups" attribute to "false". When DNS lookups are disabled,
72 request.getRemoteHost() will return the String version of the
73 IP address of the remote client.
74
75
76 < !-- Define a non-SSL HTTP/1.1 Connector on port 8080
77 < Connector
78port="80" maxHttpHeaderSize="8192"
79 maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
80 enableLookups="false" redirectPort="8443" acceptCount="100"
81 connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="GB2312"/>
82 < !-- Note : To disable connection timeouts, set connectionTimeout value

共6页: 上一页 1 [2] [3] [4] [5] [6] 下一页

上一篇:开发框架:Spring XML配置十二个最佳实践   下一篇:中间件--RFID中间件的研究现状与展望


收藏于收藏夹】 【评论】 【推荐】 【打印】 【关闭
相关文档
·中间件--RFID中间件的研究现状与展望
·开发框架:Spring XML配置十二个最佳实践
·框架:一个使用spring框架AOP的有趣例子
·设计模式:用Java快速开发Linux GUI应用
·设计及设计模式:关于Java权限控制算法
·软件工程--关于面向对象建模解决方案
·开发框架--谈hibernate二级缓存攻略
·开发框架--关于struts标签之浅入深出
·框架:闲谈JavaServer Faces的解决方案
·数据库相关--Hibernate的事务和并发
·设计及设计模式:java23种模式一点就通
·服务器及中间件--TOMCAT种集群配置
·Java模式设计之多态模式与多语言支持
·JSP/Servlet/JSF--标签库的深入研究
·开发及软件工程:软件最大的追求是什么
·对《Java与模式》中工厂方法模式的异议
发表评论
密码: 匿名评论
评论内容:

(不超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规)
 
  最新文档
·Java SE6调用Java编译器的两种新方法
·表现层框架Struts/Tapestry/JSF比较
·在Web项目中用到JNI时应该注意的问题
·JBuilder7 Weblogic7 mysql开发EJB配置
·进阶:Java Reflection (JAVA反射)详解
·以全局的固定顺序获取多个锁来避免死锁
·JAVA高级:Java中限时线程回调方式的实
·超线程多核心下Java多线程编程彻底分析
·开发JAVA编程中字符串分割的两种方法
·Java理论和实践:用软引用阻止内存泄漏
·JAVA入门基础:区分引用类型和原始类型
·学习心得 - JSP处理异常及一些高级主题
  阅读排行
·Commons-logging Log4j 的入门指南
·进阶:Java Reflection (JAVA反射)详解
·开发框架:一篇关于SSH架构的简单总结
·jboss4.0下使用MySql数据源的设置方法
·Java语言:敏捷开发技巧-消除代码异味
·Java SE6调用Java编译器的两种新方法
·数据库相关:Log4j和JDBMonitor的比较
·使用JAVA中的动态代理实现数据库连接池
·架构与模式:多线程有几种常用的编程模
·开发框架-Struts里过滤器的简单使用
·表现层框架Struts/Tapestry/JSF比较
·在Web项目中用到JNI时应该注意的问题
·Java 安全:Java 语言的 XML 验证 API
·多线程设计模式:了解wait/notify机制
·Hibernate源码中几个包的作用简要介绍
网摘收藏: