当前位置: 首页 > news >正文

张雪峰谈服装与服饰设计专业网站关键词优化排名软件系统

张雪峰谈服装与服饰设计专业,网站关键词优化排名软件系统,加盟店推广营销,网站建设及维护推广合同前言 Tomcat主配置文件(server.xml)是Tomcat服务器的主要配置文件,文件位置在conf目录下,它包含了Tomcat的全局配置信息,包括监听端口、虚拟主机、安全配置、连接器等。 目录 1 server.xml组件类别 2 组件介绍 3 se…

前言

Tomcat主配置文件(server.xml)是Tomcat服务器的主要配置文件,文件位置在conf目录下,它包含了Tomcat的全局配置信息,包括监听端口、虚拟主机、安全配置、连接器等。

目录

1 server.xml组件类别

2 组件介绍

3 server.xml配置文件详解

4 主要参数详解

 4.1 Connector主要参数详解

 4.2 host参数详解

 4.3 Context参数说明


1 server.xml组件类别

顶级组件:位于整个配置的顶层。如:server。

容器类组件:可以包含其他组件的组件。如:service、engine、host、context。

连接器组件:连接用户请求至Tomcat。如:connector。

被嵌套类组件:位于一个容器中,不能包含其他组件。如value、logger。

2 组件介绍

组件名称

功能介绍

engine

核心容器组件,定义Tomcat服务器内部的容器,与Service元素一起定义了Tomcat服务器的整体架构。catalina引擎,负责通过connector接收用户请求,并处理请求,将请求转至对应的虚拟主机host。

host

类似于httpd中的虚拟主机,一般而言支持基于FQDN的虚拟主机,允许在同一台服务器上运行多个网站或应用程序。

context

定义一个应用程序的上下文,包括Web应用程序的路径、名称、文档根目录等,是一个最内层的容器类组件(不能再嵌套)。配置context的主要目的指定对应的webapp的根目录,类似于httpd的alias,其还能为webapp指定额外的属性,如部署方式等。

connector

定义Tomcat服务器与外部应用程序或客户端之间的连接,接收用户请求,通常用于HTTP或HTTPS通讯,类似于httpd的listen配置监听端口。

Service

定义Tomcat服务器提供的服务,通常包含一个或多个Connector(连接器),但只能有一个引擎engine。

Server

定义Tomcat服务器的全局属性,其中的port属性定义了Tomcat服务器本身监听的端口号。

Valve

通过提供不同类型的阀门,拦截请求并在将其转至对应的webapp前进行某种处理操作,可以用于任何容器中,比如记录日志(access log valve)、基于IP做访问控制(remote address filter valve),实现对Tomcat服务器的访问控制、流量控制、日志记录等功能。

loggor

日志记录器,用于记录组件内部的状态信息,可以用于除context外的任何容器中。

Realm

定义Tomcat服务器的安全认证和授权机制。可以用于任意容器类的组件中,关联一个用户认证库,实现认证和授权。可以关联的认证库有: UserDatabaseRealm(使用JNDI自定义的用户认证库)、MemoryRealm(认证信息定义在tomcat-users.xml中)和JDBCRealm(认证信息定义在数据库中,并通过JDBC连接至数据库中查找认证用户)。

3 server.xml配置文件详解

server.xml 文件原版:

<?xml version="1.0" encoding="UTF-8"?>
<!--Licensed to the Apache Software Foundation (ASF) under one or morecontributor license agreements.  See the NOTICE file distributed withthis 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 withthe License.  You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed 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 andlimitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may notdefine subcomponents such as "Valves" at this level.Documentation at /docs/config/server.html-->
<Server port="8005" shutdown="SHUTDOWN"><Listener className="org.apache.catalina.startup.VersionLoggerListener" /><!-- Security listener. Documentation at /docs/config/listeners.html<Listener className="org.apache.catalina.security.SecurityListener" />--><!-- APR library loader. Documentation at /docs/apr.html --><Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /><!-- Prevent memory leaks due to use of particular java/javax APIs--><Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /><Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /><Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /><!-- Global JNDI resourcesDocumentation at /docs/jndi-resources-howto.html--><GlobalNamingResources><!-- Editable user database that can also be used byUserDatabaseRealm 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 sharea 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 receivedand responses are returned. Documentation at :Java HTTP Connector: /docs/config/http.htmlJava AJP  Connector: /docs/config/ajp.htmlAPR (HTTP/AJP) Connector: /docs/apr.htmlDefine a non-SSL/TLS HTTP/1.1 Connector on port 8080--><Connector port="8080" protocol="HTTP/1.1"connectionTimeout="20000"redirectPort="8443"maxParameterCount="1000"/><!-- A "Connector" using the shared thread pool--><!--<Connector executor="tomcatThreadPool"port="8080" protocol="HTTP/1.1"connectionTimeout="20000"redirectPort="8443"maxParameterCount="1000"/>--><!-- Define an SSL/TLS HTTP/1.1 Connector on port 8443This connector uses the NIO implementation. The defaultSSLImplementation will depend on the presence of the APR/nativelibrary and the useOpenSSL attribute of the AprLifecycleListener.Either JSSE or OpenSSL style configuration may be used regardless ofthe SSLImplementation selected. JSSE style configuration is used below.--><!--<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"maxThreads="150" SSLEnabled="true"maxParameterCount="1000"><SSLHostConfig><Certificate certificateKeystoreFile="conf/localhost-rsa.jks"type="RSA" /></SSLHostConfig></Connector>--><!-- Define an SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2This connector uses the APR/native implementation which always usesOpenSSL for TLS.Either JSSE or OpenSSL style configuration may be used. OpenSSL styleconfiguration is used below.--><!--<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"maxThreads="150" SSLEnabled="true"maxParameterCount="1000"><UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" /><SSLHostConfig><Certificate certificateKeyFile="conf/localhost-rsa-key.pem"certificateFile="conf/localhost-rsa-cert.pem"certificateChainFile="conf/localhost-rsa-chain.pem"type="RSA" /></SSLHostConfig></Connector>--><!-- Define an AJP 1.3 Connector on port 8009 --><!--<Connector protocol="AJP/1.3"address="::1"port="8009"redirectPort="8443"maxParameterCount="1000"/>--><!-- An Engine represents the entry point (within Catalina) that processesevery request.  The Engine implementation for Tomcat stand aloneanalyzes the HTTP headers included with the request, and passes themon 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"/>--><!-- Use the LockOutRealm to prevent attempts to guess user passwordsvia a brute-force attack --><Realm className="org.apache.catalina.realm.LockOutRealm"><!-- This Realm uses the UserDatabase configured in the global JNDIresources under the key "UserDatabase".  Any editsthat are performed against this UserDatabase are immediatelyavailable for use by the Realm.  --><Realm className="org.apache.catalina.realm.UserDatabaseRealm"resourceName="UserDatabase"/></Realm><Host name="localhost"  appBase="webapps"unpackWARs="true" autoDeploy="true"><!-- SingleSignOn valve, share authentication between web applicationsDocumentation at: /docs/config/valve.html --><!--<Valve className="org.apache.catalina.authenticator.SingleSignOn" />--><!-- Access log processes all example.Documentation at: /docs/config/valve.htmlNote: The pattern used is equivalent to using pattern="common" --><Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"prefix="localhost_access_log" suffix=".txt"pattern="%h %l %u %t &quot;%r&quot; %s %b" /></Host></Engine></Service>
</Server>

将原文件中英文注释行删掉并添加了中文详解注释。

<?xml version="1.0" encoding="UTF-8"?>


<Server> 元素代表整个容器,是Tomcat实例的顶层元素,由org.apache.catalina.Server接口来定义,它包含一个<Service>元素,并且它不能做为任何元素的子元素。
port 指定Tomcat监听shutdown命令端口,终止服务器运行时,必须在Tomcat服务器所在的机器上发出shutdowm命令,该属性是必须的,其端口号可以修改。
shutdown 指定终止Tomcat服务器运行时,发给Tomcat服务器的shutdown监听端口的字符串,该属性必须设置。
<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
  <GlobalNamingResources>
    <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>


Service服务组件
  <Service name="Catalina">


Connector主要参数
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443"
               maxParameterCount="1000"
               />


Engine 核心容器组件,catalina引擎,负责通过connector接收用户请求,并处理请求,将请求转至对应的虚拟主机host。
defaultHost 指定缺省的处理请求的主机名,它至少与其中的一个host元素的name属性值一样。
    <Engine name="Catalina" defaultHost="localhost">


Realm 表示存放的用户名、密码及role的数据库。 
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>


host参数
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>
    </Engine>
  </Service>
</Server>

4 主要参数详解

 4.1 Connector主要参数详解

Connector是Tomcat服务器与外部应用程序或客户端之间的连接,常见的Connector类型包括HTTP、HTTPS、AJP等。

 

参数

参数说明

Connector

定义Tomcat服务器与外部应用程序或客户端之间的连接,接收用户请求,通常用于HTTP或HTTPS通讯,类似于httpd的listen配置监听端口。

port

指定Connector监听的端口号,用于监听来自客户端的请求。

protocol

连接器使用的协议,指定Connector要使用的协议类型,常见的有HTTP/1.1、HTTP/2、AJP/1.3等。

connectionTimeout

指定超时的时间数(以毫秒为单位),即在指定时间内未收到客户端请求,则连接被关闭。

redirectPort

指定重定向端口,即在使用HTTPS时,自动将HTTP请求重定向到HTTPS。

maxParameterCount

最大可以创建的处理请求的线程数。

 4.2 host参数详解

在Tomcat中,一个物理服务器可以部署多个虚拟主机,每个虚拟主机拥有自己的域名和独立的配置,这些虚拟主机通过Host元素来实现。

 

参数

参数说明

host

Server元素的子元素,代表一个虚拟主机

name

虚拟主机的名称

appBase

指定该虚拟主机的Web应用程序的基础目录,Web应用程序在该目录下部署。

unpackWARs

是否在部署Web应用程序时解压WAR文件,可以提高Web应用程序的访问速度。

autoDeploy

是否自动部署新的Web应用程序,如果设置为true,则Tomcat会自动检测appBase目录下的新的Web应用程序,并进行自动部署。

 4.3 Context参数说明

在Tomcat中,Context参数是指一个Web应用程序的上下文信息,它包含了Web应用程序的配置信息、资源、Servlet等。当一个Web应用程序被部署到Tomcat服务器上时,Tomcat会为该Web应用程序创建一个Context对象,用于管理Web应用程序的运行时状态。

参数

参数说明

Context

表示一个web应用程序,通过为war文件。

docBase

表示Web应用程序的根目录,即Web应用程序的发布目录。应用程序的路径或者是WAR文件存放的路径,也可以使用相对路径,起始路径为此Context所属Host中appBase定义的路径。

path

表示Web应用程序的上下文路径,即访问该Web应用程序的URL路径。

reloadable

这个属性非常重要,如果为true,则tomcat会白动检测应用程序的/WEB-INF/lib和/WEB-INF/classes目录的变化,自动装载新的应用程序,可以在不重启tomcat的情况下改变应用程序。

crossContext

用于指定不同的Web应用程序之间是否可以共享ServletContext对象。如果crossContext被设置为true,则表示允许跨上下文共享ServletContext对象,否则不允许。

http://www.hkea.cn/news/318994/

相关文章:

  • 六合哪家做网站建设域名注册查询软件
  • 网站建设的方案费用2023年新冠疫情最新消息
  • 九星市场做网站快速将网站seo
  • 长春做网站推广的公司提升神马关键词排名报价
  • 金融网站cms百度网盘客服电话人工服务
  • 美观网站建设物美价廉seo网站优化专员
  • 网站设计应该怎么做推广软文代写
  • 网站建设工作室发展百度收录教程
  • 没有网站 可以做百度口碑吗成都网站制作
  • 医院系统网站建设百度宁波营销中心
  • 网站劫持代码杭州互联网公司排名榜
  • 做网站找哪个部门吸引人的推广标题
  • 网站制作软件名字线做竞价推广代运营公司
  • avada如何做中英文网站沈阳百度推广排名优化
  • 做网站品长沙网络营销公司排名
  • b2b商贸网站环球网最新消息疫情
  • wordpress next主题什么是seo教程
  • 如何规划一个网站快手秒赞秒评网站推广
  • 中国网站开发网站seo需要用到哪些工具
  • 织梦做的网站首页出现空白网页平台做个业务推广
  • 备案做电影网站吗yandx引擎入口
  • 网站双倍浮动百度账号登陆入口
  • 聊城市网站建设网站推广排名
  • 帝国新闻网站模板百度seo推广怎么做
  • 预约做港澳证的网站网站排名在线优化工具
  • 罗湖实惠的网站建设费用成都官网seo厂家
  • 建设部官方网站有哪些优帮云排名优化
  • 天津做网站找谁新东方在线教育平台官网
  • 南宁做网站在哪了日本预测比分
  • 咋样查看网站用什么编程语言做的9个广州seo推广神技