tomcat的文件结构和组成
目录结构
目录 | 说明 |
---|---|
bin | 服务启动、停止等相关 |
conf | 配置文件 |
lib | 库目录 |
logs | 日志目录 |
webapps | 应用程序,应用部署目录 |
work | jsp编译后的结果文件,建议提前预热访问 |
范例:查看tomcat相关目录和文件
[root@centos8 tomcat]#pwd
/usr/local/tomcat
[root@centos8 tomcat]#ls
bin conf lib logs README.md RUNNING.txt webapps
BUILDING.txt CONTRIBUTING.md LICENSE NOTICE RELEASE-NOTES temp work
[root@centos8 tomcat]#ls bin
bootstrap.jar ciphers.sh daemon.sh shutdown.bat tomcat-native.tar.gz
catalina.bat commons-daemon.jar digest.bat shutdown.sh tool-wrapper.bat
catalina.sh commons-daemon-native.tar.gz digest.sh startup.bat tool-wrapper.sh
catalina-tasks.xml configtest.bat setclasspath.bat startup.sh version.bat
ciphers.bat configtest.sh setclasspath.sh tomcat-juli.jar version.sh
[root@centos8 tomcat]#ls conf
Catalina context.xml logging.properties tomcat-users.xml
catalina.policy jaspic-providers.xml server.xml tomcat-users.xsd
catalina.properties jaspic-providers.xsd tomcat.conf web.xml
[root@centos8 tomcat]#ls lib
annotations-api.jar ecj-4.6.3.jar servlet-api.jar tomcat-i18n-fr.jar tomcat-jni.jar
catalina-ant.jar el-api.jar tomcat-api.jar tomcat-i18n-ja.jar tomcat-util.jar
catalina-ha.jar jasper-el.jar tomcat-coyote.jar tomcat-i18n-ko.jar tomcat-util-scan.jar
catalina.jar jasper.jar tomcat-dbcp.jar tomcat-i18n-ru.jar tomcat-websocket.jar
catalina-storeconfig.jar jaspic-api.jar tomcat-i18n-de.jar tomcat-i18n-zh-CN.jar websocket-api.jar
catalina-tribes.jar jsp-api.jar tomcat-i18n-es.jar tomcat-jdbc.jar
[root@centos8 tomcat]#ls logs
catalina.2020-02-09.log host-manager.2020-02-09.log localhost_access_log.2020-02-09.txt
catalina.out localhost.2020-02-09.log manager.2020-02-09.log
[root@centos8 tomcat]#ls webapps/
docs examples host-manager manager ROOT
[root@centos8 tomcat]#ls work/
Catalina
[root@centos8 tomcat]#ls work/Catalina/
localhost
[root@centos8 tomcat]#ls work/Catalina/localhost/
docs examples host-manager manager ROOT
[root@centos8 tomcat]#ll -i work/Catalina/localhost/
total 0
68039883 drwxr-x--- 2 tomcat tomcat 6 Feb 9 11:02 docs
135579640 drwxr-x--- 2 tomcat tomcat 6 Feb 9 11:02 examples
202681358 drwxr-x--- 2 tomcat tomcat 6 Feb 9 11:02 host-manager
571365 drwxr-x--- 2 tomcat tomcat 6 Feb 9 11:02 manager
571364 drwxr-x--- 2 tomcat tomcat 6 Feb 9 11:02 ROOT
[root@centos8 tomcat]#ll -i webapps/
total 4
202681088 drwxr-x--- 15 tomcat tomcat 4096 Feb 9 11:02 docs
202681094 drwxr-x--- 6 tomcat tomcat 83 Feb 9 11:02 examples
571165 drwxr-x--- 5 tomcat tomcat 87 Feb 9 11:02 host-manager
68039687 drwxr-x--- 5 tomcat tomcat 103 Feb 9 11:02 manager
68039663 drwxr-x--- 3 tomcat tomcat 283 Feb 9 11:02 ROOT
[root@centos8 tomcat]#tree work/Catalina/localhost/
work/Catalina/localhost/
├── docs
├── examples
├── host-manager
├── manager
└── ROOT
5 directories, 0 files
[root@centos8 tomcat]#curl http://10.0.0.8:8080/
#当访问过后,work目录中生成新文件
[root@centos8 tomcat]#tree work/Catalina/localhost/
work/Catalina/localhost/
├── docs
├── examples
├── host-manager
├── manager
└── ROOT
└── org
└── apache
└── jsp
├── index_jsp.class
└── index_jsp.java
8 directories, 2 files
#tomcat会自动的将jsp文件生成java源文件,再编译成功class文件
[root@centos8 tomcat]#less work/Catalina/localhost/ROOT/org/apache/jsp/index_jsp.java
/*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/8.5.50
* Generated at: 2020-02-09 03:20:20 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent,
org.apache.jasper.runtime.JspSourceImports {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
配置文件
官方帮助文档:http://tomcat.apache.org/tomcat-8.5-doc/index.html
在tomcat安装目录下的conf子目录中,有以下的tomcat的配置文件
文件名 | 说明 |
---|---|
server.xml | 主配置文件 |
web.xml | 每个webapp只有“部署”后才能被访问,它的部署方式通常由web.xml进行定义,其存放位置为WEB-INF/目录中;此文件为所有的webapps提供默认部署相关的配置 |
context.xml | 用于定义所有web应用均需加载的Context配置,此文件为所有的webapps提供默认配置,每个web应用也可以使用自已专用的配置,它通常由专用的配置文件context.xml来定义,其存放位置为WEB-INF/目录中 |
tomcat-users.xml | 用户认证的账号和密码文件 |
catalina.policy | 当使用security选项启动tomcat时,用于为tomcat设置安全策略 |
catalina.properties | Tomcat 环境变量的配置,用于设定类加载器路径,以及一些与JVM调优相关参数 |
logging.properties | Tomcat 日志系统相关的配置,可以修改日志级别和日志路径等 |
注意:配置文件大小写敏感
范例:查看配置文件
[root@centos8 conf]#pwd
/usr/local/tomcat/conf
[root@centos8 conf]#ls
Catalina context.xml logging.properties tomcat-users.xml
catalina.policy jaspic-providers.xml server.xml tomcat-users.xsd
catalina.properties jaspic-providers.xsd tomcat.conf web.xml
[root@centos8 conf]#wc -l server.xml web.xml context.xml tomcat-users.xml catalina.policy catalina.properties logging.properties
167 server.xml
4726 web.xml
30 context.xml
44 tomcat-users.xml
271 catalina.policy
214 catalina.properties
75 logging.properties
5527 total
[root@centos8 conf]#
本文链接:https://www.yunweipai.com/35127.html
网友评论comments