tomcat配置多个站点。可以这样。

在conf文件夹下创建文件:..conf\Catalina\localhost\aa.xml

aa.xml的内容。如:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Context path="/aa" docBase="D:\chenweixian\apache-tomcat-7.0.10_test\webapps\aa" debug="0" reloadable="true">
  3.  
  4. </Context>

访问时,就是http://localhost:8080/aa

server.xml内容:

  1. <?xml version='1.0' encoding='utf-8'?>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9.  
  10. http://www.apache.org/licenses/LICENSE-2.0
  11.  
  12. Unless required by applicable law or agreed to in writing, software
  13. distributed under the License is distributed on an "AS IS" BASIS,
  14. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. See the License for the specific language governing permissions and
  16. limitations under the License.
  17. -->
  18. <!-- Note: A "Server" is not itself a "Container", so you may not
  19. define subcomponents such as "Valves" at this level.
  20. Documentation at /docs/config/server.html
  21. -->
  22. <Server port="8805" shutdown="SHUTDOWN">
  23. <!-- Security listener. Documentation at /docs/config/listeners.html
  24. <Listener className="org.apache.catalina.security.SecurityListener" />
  25. -->
  26. <!--APR library loader. Documentation at /docs/apr.html -->
  27. <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  28. <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
  29. <Listener className="org.apache.catalina.core.JasperListener" />
  30. <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  31. <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  32. <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  33. <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
  34.  
  35. <!-- Global JNDI resources
  36. Documentation at /docs/jndi-resources-howto.html
  37. -->
  38. <GlobalNamingResources>
  39. <!-- Editable user database that can also be used by
  40. UserDatabaseRealm to authenticate users
  41. -->
  42. <Resource name="UserDatabase" auth="Container"
  43. type="org.apache.catalina.UserDatabase"
  44. description="User database that can be updated and saved"
  45. factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
  46. pathname="conf/tomcat-users.xml" />
  47. <Resource name="jdbc/spas/krcsDS" auth="Container" description="DB Connection" type="javax.sql.DataSource" username="spasopr" password="80986318502351043868505718353380253815" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@d0spas.dbdev.paic.com.cn:1536:d0spas" maxActive="5" />
  48. </GlobalNamingResources>
  49.  
  50. <!-- A "Service" is a collection of one or more "Connectors" that share
  51. a single "Container" Note: A "Service" is not itself a "Container",
  52. so you may not define subcomponents such as "Valves" at this level.
  53. Documentation at /docs/config/service.html
  54. -->
  55. <Service name="Catalina">
  56.  
  57. <!--The connectors can use a shared executor, you can define one or more named thread pools-->
  58. <!--
  59. <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
  60. maxThreads="150" minSpareThreads="4"/>
  61. -->
  62.  
  63. <!-- A "Connector" represents an endpoint by which requests are received
  64. and responses are returned. Documentation at :
  65. Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
  66. Java AJP Connector: /docs/config/ajp.html
  67. APR (HTTP/AJP) Connector: /docs/apr.html
  68. Define a non-SSL HTTP/1.1 Connector on port 8080
  69. -->
  70. <Connector port="8880" protocol="HTTP/1.1"
  71. connectionTimeout="20000"
  72. redirectPort="8443" URIEncoding="utf-8"/>
  73. <!-- A "Connector" using the shared thread pool-->
  74. <!--
  75. <Connector executor="tomcatThreadPool"
  76. port="8080" protocol="HTTP/1.1"
  77. connectionTimeout="20000"
  78. redirectPort="8443" />
  79. -->
  80. <!-- Define a SSL HTTP/1.1 Connector on port 8443
  81. This connector uses the JSSE configuration, when using APR, the
  82. connector should be using the OpenSSL style configuration
  83. described in the APR documentation -->
  84. <!--
  85. <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
  86. maxThreads="150" scheme="https" secure="true"
  87. clientAuth="false" sslProtocol="TLS" />
  88. -->
  89.  
  90. <!-- Define an AJP 1.3 Connector on port 8009 -->
  91. <Connector port="8809" protocol="AJP/1.3" redirectPort="8443" />
  92.  
  93. <!-- An Engine represents the entry point (within Catalina) that processes
  94. every request. The Engine implementation for Tomcat stand alone
  95. analyzes the HTTP headers included with the request, and passes them
  96. on to the appropriate Host (virtual host).
  97. Documentation at /docs/config/engine.html -->
  98.  
  99. <!-- You should set jvmRoute to support load-balancing via AJP ie :
  100. <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
  101. -->
  102. <Engine name="Catalina" defaultHost="localhost">
  103.  
  104. <!--For clustering, please take a look at documentation at:
  105. /docs/cluster-howto.html (simple how to)
  106. /docs/config/cluster.html (reference documentation) -->
  107. <!--
  108. <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
  109. -->
  110.  
  111. <!-- Use the LockOutRealm to prevent attempts to guess user passwords
  112. via a brute-force attack -->
  113.  
  114. <Realm className="org.apache.catalina.realm.CombinedRealm" >
  115. <!-- This Realm uses the UserDatabase configured in the global JNDI
  116. resources under the key "UserDatabase". Any edits
  117. that are performed against this UserDatabase are immediately
  118. available for use by the Realm. -->
  119. <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
  120. resourceName="UserDatabase"/>
  121. <Realm className="org.apache.catalina.realm.JNDIRealm" debug="99"
  122. connectionURL="ldap://10.25.32.17:13001"
  123. connectionName="cn=realm,cn=Users,dc=paic,dc=com,dc=cn"
  124. connectionPassword="realm123"
  125. userPattern="uid={0},ou=staff,ou=People,o=paic.com.cn"
  126. />
  127. </Realm>
  128.  
  129. <Host name="localhost" appBase="webapps"
  130. unpackWARs="true" autoDeploy="true">
  131.  
  132. <!-- SingleSignOn valve, share authentication between web applications
  133. Documentation at: /docs/config/valve.html -->
  134. <!--
  135. <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
  136. -->
  137.  
  138. <!-- Access log processes all example.
  139. Documentation at: /docs/config/valve.html
  140. Note: The pattern used is equivalent to using pattern="common" -->
  141. <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
  142. prefix="localhost_access_log." suffix=".txt"
  143. pattern="%h %l %u %t &quot;%r&quot; %s %b" resolveHosts="false"/>
  144.  
  145. </Host>
  146. </Engine>
  147. </Service>
  148. </Server>

Tomcat配置多站点的更多相关文章

  1. 转:Tomcat安装配置及站点说明

    原文地址:http://www.cnblogs.com/Johness/archive/2012/07/20/2600937.html 1.首先是Tomcat的获取和安装. 获取当然得上Apache的 ...

  2. nginx,apache,tomcat配置https的阿里提供的文档

    安装证书 ( 1 ) 打开 Nginx 安装目录下 conf 目录中的 nginx.conf 文件,找到 # HTTPS server # #server { # listen 443; # serv ...

  3. '[linux下tomcat 配置

    tomcat目录结构 bin ——Tomcat执行脚本目录 conf ——Tomcat配置文件 lib ——Tomcat运行需要的库文件(JARS) logs ——Tomcat执行时的LOG文件 te ...

  4. nginx+tomcat配置https

    nginx代理https后,应用redirect https变成http,很多页面报404.情况类似http://blog.sina.com.cn/s/blog_56d8ea900101hlhv.ht ...

  5. Tomcat配置全攻略

    tomcat的的下载地址http://www.apache.org/dist/jakarta/tomcat-4/ 1.安装jdk,详细操作请参考本站windows 2k和redhat 8.0下java ...

  6. 实战Tomcat配置SSL,使用openssl制作证书

    制作证书以及Tomcat配置 搭建openssl环境,下载openssl并设置环境变量方便命令行的使用: 修改openssl配置文件,设置dir目录,如设置dir=e:/temp/openssl_ca ...

  7. tomcat配置调优与安全总结

    http://vekergu.blog.51cto.com/9966832/1672931 tomcat配置调优与安全总结 作为运维,避免不了与tomcat打交道,然而作者发现网络上关于tomcat配 ...

  8. (转)Tomcat配置调优与安全总结

    tomcat配置调优与安全总结 作为运维,避免不了与tomcat打交道,然而作者发现网络上关于tomcat配置和调优安全的文章非常散,通过参考各位大神的相关技术文档,根据作者对tomcat的运维经验, ...

  9. 单点登录 SSO, 自动登录 , java 加密,ssl原理, Tomcat配置SSL

    韩梦飞沙  韩亚飞  313134555@qq.com  yue31313  han_meng_fei_sha 单点登录的英文简称为SSO(single sign on),单点登录功能使得用户只要登录 ...

随机推荐

  1. mysql导入数据报错:Incorrect datetime value

    incorrect datetime value 报错信息如下图: 意思很明显是说,'0000-00-00 00:00:00'不是一个有效的日期类型的值 解决办法: sql_mode 中删除 NO_Z ...

  2. Oracle 11.2.0.4_Linux单例篇

    Linux 下安装Oracle步骤: 1.设置ip地址  2.设置主机名 3.安装oracle依赖的软件包 mkdir /media/cdrom -p mount /dev/cdrom  /media ...

  3. 二维码生成工具类java版

    注意:这里我不提供所需jar包的路径,我会把所有引用的jar包显示出来,大家自行Google package com.net.util; import java.awt.BasicStroke; im ...

  4. 【转载】在一台电脑上运行两个或两个以上的tomcat

    作者注: 本片为转载文章,一台电脑运行两个及以上tomcat的原因是:第一个eclipse版本是4.5,最高支持tomcat8.0版本,并且这个版本的eclipse通过svn提交和更新项目极其缓慢,无 ...

  5. C#字典转对象

    /// <summary> /// Assign parameters to specified objects /// </summary> /// <typepara ...

  6. 怎样获取所有style节点

    通过 document.styleSheets 获取所有的样式表节点. document.styleSheets instanceof StyleSheetList; // true 注意: 1. 返 ...

  7. 作业3:java对象模型

    一 对象表示机制 1 Hotsplot JVM内部对象表示系统 (1)OOP-Klass二分模型 OOP:Ordinary Object Pointer 或者OOPS.即普通对象指针,描述对象实例信息 ...

  8. React-脚手架

    1. Node和NPM 版本 2. 脚手架 在对React比较熟悉之前,为了避免陷入到开发工具的繁琐配置中,借助react官方提供的脚手架工具Create React App来搭建React应用 np ...

  9. NopCommerce的autofac的理解

    nop项目4.1是core.2.1开发的,Startup.cs文件开始 从入口进去ServiceCollectionExtensions这个文件 this IServiceCollection ser ...

  10. ECMAScript中的原型继承

    //ECMAScript中的原型继承//ECMAScript中的继承主要是依靠原型链实现的.(关于原型链的介绍,详见<高三>6.3.1章节 P162) //本文示例主要为了说明SubTyp ...