Tomcat目录中的server.xml配置文件
server.xml称为主配置文件或全局配置文件
它完成以下两个目标:
1,提供Tomcat组件的初始化配置
2,说明Tomcat的结构和含义,使得Tomcat通过实例化组件完成启动及构建自身
代码解析如下:
<span style="font-size: 15px; color: #0000ff;"><span style="font-size: 16px;"><strong> <<span style="color: #ff00ff;">Server</span> port="8005" shutdown="SHUTDOWN"> <<span style="color: #ff00ff;">Listener</span> className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <<span style="color: #ff00ff;">Listener</span> className="org.apache.catalina.core.JasperListener" /> <<span style="color: #ff00ff;">Listener</span> className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <<span style="color: #ff00ff;">Listener</span> className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <<span style="color: #ff00ff;">Listener</span> className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <<span style="color: #ff00ff;">GlobalNamingResources</span>> <span style="color: #ff0000;"><!-- 全局命名资源,来定义一些外部访问资源,其作用是为所有引擎应用程序所引用的外部资源的定义 --!></span> <<span style="color: #ff00ff;">Resource</span> 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" /> </<span style="color: #ff00ff;">GlobalNamingResources</span>> <span style="color: #ff0000;"><!-- 定义的一个名叫“UserDatabase”的认证资源,将conf/tomcat-users.xml加载至内存中,在需要认证的时候到内存中进行认证 --></span> <<span style="color: #ff00ff;">Service</span> name="Catalina"> <span style="color: #ff0000;"> <!-- # 定义Service组件,同来关联Connector和Engine,一个Engine可以对应多个Connector,每个Service中只能一个Engine --!></span> <<span style="color: #ff00ff;">Connector</span> port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <span style="color: #ff0000;"> <!-- 修改HTTP/1.1的Connector监听端口为8080.客户端通过浏览器访问的请求,只能通过HTTP传递给tomcat。 --></span> <<span style="color: #ff00ff;">Connector</span> port="8009" protocol="AJP/1.3" redirectPort="8443" /> <<span style="color: #ff00ff;">Engine</span> name="Catalina" defaultHost="localhost"> <span style="color: #ff0000;"> <!-- 修改当前Engine,默认主机是localhost --></span> <<span style="color: #ff00ff;">Realm</span> className="org.apache.catalina.realm.LockOutRealm"> <<span style="color: #ff00ff;">Realm</span> className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </<span style="color: #ff00ff;">Realm</span>> <span style="color: #ff0000;"> <-- Realm组件,定义对当前容器内的应用程序访问的认证,通过外部资源UserDatabase进行认证 --></span> <<span style="color: #ff00ff;">Host</span> name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <span style="color: #ff0000;"> <!-- 定义一个主机,域名为:localhost,应用程序的目录是webapps,设置自动部署,自动解压 --></span> <<span style="color: #ff00ff;">Context</span> path="" docBase=""/usr/local/tomcat/webfile" " reloadable="true" /> <span style="color: #ff0000;"> <!--定义该应用程序,访问路径"“,并且当该应用程序下web.xml或者类等有相关变化时,自动重载当前配置,即不用重启tomcat使部署的新应用程序生效--></span> <<span style="color: #ff00ff;">Valve</span> className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> <span style="color: #ff0000;"> <!-- 定义一个Valve组件,用来记录tomcat的访问日志,日志存放目录为:logs如果定义为相对路径则是相当于$CATALINA_HOME,</span></strong></span><strong><span style="color: #ff0000;">并非相对于appBase,</span><br /><span style="color: #ff0000;"> 这个要注意。定义日志文件前缀为<span style="font-size: 15px;"><span style="font-size: 16px;"><strong>localhost_access_log</strong></span></span>并以.txt结尾,pattern定义日志内容格式,具体字段表示可以查看tomcat官方文档--></span> </<span style="color: #ff00ff;">Host</span>> </<span style="color: #ff00ff;">Engine</span>> </<span style="color: #ff00ff;">Service</span>> </<span style="color: #ff00ff;">Server</span>> </strong></span>
标签功能如下:
server标签:根元素,它代表整个容器,是Tomcat实例的顶层元素.由org.apache.catalina.Server接口来定义.它包含一个
Listener标签:监听器,用来管理Tomcat生命周期和全局资源
GlobalNamingResources标签:配置系统的JNDI
Service标签:该元素由org.apache.catalina.Service接口定义,它包含一个
Connector标签:连接器,代表外部客户之间的接口,将在一个指定的接口上侦听客户请求,将请求给Engine进行处理Connector之间的port不能重复,否则会报JVM BIND 端口号冲突的问题
Enger标签:引擎,每个Service元素只能有一个Engine元素.元素处理在同一个
Realm标签:定义对当前容器内的应用程序访问的认证,通过外部资源UserDatabase进行认证
Logger标签:
Host标签:它由Host接口定义.一个Engine元素可以包含多个
Logger标签:日志和错误信息
Context标签:web应用组,它由Context接口定义.是使用最频繁的元素.每个

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version
Visual web development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.