tomcat的配置文件server.conf中的元素的理解

tomcat的配置文件server.conf中的元素的理解


 

tomcat作为一个servlet服务器本身的配置文件是tomcat_home/conf/server.conf,这个配置文件中有很多元素,这些元素各是什么意思,需要搞清楚,这里记录一下目前清楚的几个元素的含义。

tomcat本身是由一系列可配置的组件组成的,配置文件中的每一个元素都代表一个tomcat的组件。

 

1、Server元素

=============

Server元素代表servlet容器本身。

1
A Server element represents the entire Catalina servlet container.Therefore, <br>it must be the single outermost element in the <code>conf/server.xml</code> configuration file. <br>Its attributes represent the characteristics of the servlet container as a whole.

 

2、Service

==========

Service元素代表了connector和engine的组合。

1
2
A Service element represents the combination of one or more Connector components<br>that share a single Engine component for processing incoming requests.
One or more Service elements may be nested inside a Server element.

  

3、Engine元素

===============

Engine元素代表了一个Service组件的整个请求处理机构。

1
2
3
The Engine element represents the entire request processing machinery associated with a particular Catalina Service. <br>It receives and processes all requests from one or more Connectors, <br>and returns the completed response to the Connector for ultimate transmission back to the client.
 
Exactly one Engine element MUST be nested inside a Service element, <br>following all of the corresponding Connector elements associated with this Service.

  

4、service中的两种connector

========================

在service元素中有两个connector元素,这两个connector元素的protocol属性的值是不一样的,一个是HTTP/1.1,另一个是AJP/1.3。

1
2
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>

 

它们两者的区别如下:

Tomcat中HTTP与AJP的区别:
Tomcat服务器通过Connector连接器组件与客户程序建立连接,Connector组件负责接收客户的请求,以及把Tomcat服务器的响应结果发送给客户。默认情况下,Tomcat在server.xml中配置了两种连接器:

第一个连接器监听8080端口,负责建立HTTP连接。在通过浏览器访问Tomcat服务器的Web应用时,使用的就是这个连接器。

第二个连接器监听8009端口,负责和其他的HTTP服务器建立连接。在把Tomcat与其他HTTP服务器集成时,就需要用到这个连接器。

 

5、未完待续

===============

。。。

 

 

参考资料:

1、tomcat 9 docs的configuration页面,https://tomcat.apache.org/tomcat-9.0-doc/config/service.html

2、Tomcat: Connector中HTTP与AJP差别与整合,https://www.cnblogs.com/itcomputer/p/4873823.html

 

 

 

 

posted @   zhangzl419  阅读(257)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示