小问题出大错误,总有人在小地方摔跤。
下面是好几位同学问的同学的问题。
配置的主要 节点
<Host name="www.abc.cn" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>www.abc.cn</Alias>
<Context path="" docBase="abc" debug="0" reloadable="true"/>
</Host>
<Host name="www.def.com" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>www.def.com</Alias>
<Context path="" docBase="def" debug="0" reloadable="true"/>
</Host>
<?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN">
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina">
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation -->
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- The request dumper valve dumps useful debugging information about
the request and response data received and sent by Tomcat.
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-->
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<!-- -->
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
-->
</Host>
<Host name="www.abc.cn" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>www.abc.cn</Alias>
<Context path="" docBase="abc" debug="0" reloadable="true"/>
</Host>
<Host name="www.def.com" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Alias>www.def.com</Alias>
<Context path="" docBase="def" debug="0" reloadable="true"/>
</Host>
</Engine>
</Service>
</Server>
分享到:
相关推荐
### Tomcat域名设置与配置详解 #### 一、引言 Apache Tomcat 是一款开源的Servlet容器,主要用于部署Java Web应用程序。它支持最新的Servlet、JSP等规范,并且提供了简单的开发环境来部署Web应用。在实际的应用...
以下是对"tomcat多域名配置"这一主题的详细解释。 一、为什么需要多域名配置? 在互联网中,一个IP地址可以对应多个域名,这是通过DNS(域名系统)解析实现的。在服务器端,特别是像Tomcat这样的应用服务器,为了...
这在实际应用中非常有用,例如当需要快速部署多个项目时,可以通过配置一个主域名下的多个子域名,每个子域名对应不同的服务或者应用程序,这样就可以避免为每个项目单独申请域名所带来的不便。 #### 二、准备工作 ...
Tomcat 域名绑定详解 在本文中,我们将详细讨论 Tomcat 域名绑定的相关知识点,并提供实践经验,以帮助...通过修改 Tomcat 配置文件,绑定域名到项目,并实现路由映射,我们可以将网站部署到域名上,并实现域名访问。
通过本文介绍的方法,不仅可以实现Tomcat与特定域名的基本绑定,还能进一步扩展至多域名配置以及虚拟目录的设置,同时也解决了本地服务器映射到公网的问题。这对于个人开发者或是小型企业来说是非常实用的技术积累。
当涉及到“tomcat域名绑定”,我们实际上是在讨论如何配置Tomcat来处理来自不同域名的请求,并将它们映射到特定的应用程序目录。这个过程通常称为虚拟主机配置,允许在一个单一的Tomcat实例上托管多个独立的Web站点...
为了使其他域名能访问,可能需要配置Tomcat监听所有IP地址(0.0.0.0),或者特定的公网IP。这可以通过修改`server.xml`中的`<Connector>`标签来实现。 4. **SSL/TLS支持**:如果需要启用HTTPS,需要配置SSL证书。在...
配置域名对于将Tomcat服务器暴露在互联网上并提供服务是至关重要的。以下是一个详细的步骤指南,帮助你了解如何为Tomcat服务器配置域名。 首先,你需要拥有一个已注册的域名,例如example.com。这个域名需要指向你...
当我们谈论“Tomcat配置虚拟目录,外加域名解析”,这涉及到两个关键概念:一是如何在Tomcat服务器上设置虚拟主机(virtual hosts),使得一个Tomcat实例可以服务于多个不同的域名或网站;二是如何进行DNS域名解析,...
在Linux环境中,使用Apache HTTP服务器和Tomcat应用服务器配置多个域名(包括二级域名)是一项常见的任务,这可以实现一个服务器托管多个网站或者服务。Apache通常作为前端服务器处理静态内容,而Tomcat则作为后端...
**hosts**:这是一个系统级别的文件,用于将域名映射到IP地址。在整合过程中,可能会修改此文件以确保正确解析不同的域名或虚拟主机。 **workers.properties.minimal**:这是Apache mod_jk模块的一部分,mod_jk负责...
此外,可以在`server.xml`中配置虚拟主机,通过不同的域名或端口号映射到不同的项目,实现多个项目在同一Tomcat服务器上的并存。 在Eclipse环境中,可以借助Tomcat插件简化部署流程。下载插件,解压后放入Eclipse的...
在Tomcat 6.0环境下进行域名配置主要包括两部分:DNS映射以及Tomcat服务器的配置。 1. **DNS映射** 在Windows系统中,DNS映射可以通过编辑`C:\WINDOWS\system32\drivers\etc\hosts`文件实现。具体操作是在`hosts`...
通过上述分析可知,`server.xml`配置文件是Tomcat运行的基础,通过对其中各元素的合理配置,不仅可以满足基本的应用部署需求,还能实现更为复杂的场景,如多域名绑定、项目映射等。掌握这些配置技巧,能够帮助开发者...
【Tomcat配置Web站点详解】 ...总之,配置Tomcat Web站点涉及下载安装、启动停止、虚拟目录和虚拟主机的设置,以及与其他服务器的集成。理解这些概念和操作对于有效地管理和部署Java Web应用至关重要。
完成以上配置后,可以通过动态域名`http://mysite.gnway.net/项目名称`访问Tomcat应用,验证集群是否配置成功。 ### 总结 通过本文档的步骤,可以实现Apache结合动态域名解析软件和JK+Tomcat集群的配置。这种方式...
例如,在Windows系统中,编辑`C:\Windows\System32\drivers\etc\hosts`文件,Linux系统中编辑`/etc/hosts`文件,添加相应的IP和域名映射。 2. **Tomcat目录结构**:在Tomcat的webapps目录下创建两个副本,比如命名...
"tomcat_config.zip"这个压缩包显然包含了与Tomcat配置相关的文件,目的是为了简化和优化多项目的部署流程,包括HTTPS协议配置、域名绑定、图片上传支持、热部署设置、端口调整以及证书管理等关键环节。下面我们将...
2. **虚拟主机(Virtual Hosts)**:在Apache配置中,需要设置虚拟主机来区分不同的域名或项目。每个虚拟主机可以有自己的文档根目录和配置。 3. **负载均衡(Load Balancing)**:通过mod_proxy_balancer模块,...