欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Tomcat-目录介绍

程序员文章站 2022-07-14 10:48:06
...

#一、tomcat主目录介绍

[aaa@qq.com ~]# cd /data/application/tomcat/
[aaa@qq.com tomcat]# yum -y install tree

[aaa@qq.com tomcat]# tree -L 1     #只查看一层目录
.
├── bin     #存放tomcat的管理脚本
├── BUILDING.txt
├── conf    #tomcat的配置文件
├── CONTRIBUTING.md
├── lib      #web应用调用的jar包存放路径
├── LICENSE
├── logs     #tomcat日志存放目录,catalin.out日志为只要输出日志
├── NOTICE
├── README.md
├── RELEASE-NOTES
├── RUNNING.txt
├── temp     #存放临时文件
├── webapps  #默认网站发布目录
└── work     #存放编译生产的.java与.class文件

7 directories, 7 files

#二、webapps目录介绍

[aaa@qq.com tomcat]# cd /data/application/tomcat/webapps/
[aaa@qq.com webapps]# tree -L 1
.
├── docs  #tomcat的帮助文档
├── examples  #web应用实例
├── host-manager  #主机管理
├── manager    #管理
└── ROOT    #默认站点根目录

5 directories, 0 files

#三、Tomcat配置文件目录介绍(conf)

[aaa@qq.com webapps]# cd /data/application/tomcat//conf/
[aaa@qq.com conf]# tree -L 1
.
├── Catalina
├── catalina.policy
├── catalina.properties
├── context.xml
├── logging.properties
├── logs
├── server.xml           # tomcat 主配置文件
├── server.xml.bak
├── server.xml.bak2
├── tomcat-users.xml    # tomcat 管理用户配置文件
├── tomcat-users.xsd
└── web.xml

2 directories, 10 files

#四、Tomcat的管理

# 启动程序 
[aaa@qq.com ~]# /data/application/tomcat/bin/startup.sh

# 关闭程序 
[aaa@qq.com ~]# /data/application/tomcat/bin/shutdown.sh

#####启动停止:

[aaa@qq.com conf]# cd /data/application/tomcat/bin/
[aaa@qq.com bin]# ./startup.sh 
Using CATALINA_BASE:   /data/application/tomcat
Using CATALINA_HOME:   /data/application/tomcat
Using CATALINA_TMPDIR: /data/application/tomcat/temp
Using JRE_HOME:        /usr/local/java
Using CLASSPATH:       /data/application/tomcat/bin/bootstrap.jar:/data/application/tomcat/bin/tomcat-juli.jar
Tomcat started.
[aaa@qq.com bin]# ./shutdown.sh 
Using CATALINA_BASE:   /data/application/tomcat
Using CATALINA_HOME:   /data/application/tomcat
Using CATALINA_TMPDIR: /data/application/tomcat/temp
Using JRE_HOME:        /usr/local/java
Using CLASSPATH:       /data/application/tomcat/bin/bootstrap.jar:/data/application/tomcat/bin/tomcat-juli.jar

注意:tomcat未启动的情况下使用shutdown脚本,会有大量的输出信息。

#####检查tomcat是否启动正常:

[aaa@qq.com ~]# netstat -lntp  |grep java
tcp6       0      0 :::8080                 :::*                    LISTEN      18939/java          
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      18939/java          
tcp6       0      0 :::8009                 :::*                    LISTEN      18939/java

#####端口:

  • 8005:这个端口负责监听关闭Tomcat的请求 shutdown:向以上端口发送的关闭服务器的命令字符串。
  • 8009: 与其他服务通信接口,接受其他服务器转发过来的请求
  • 8080: 建立http连接用。可以修改

**说明:**所有与 java 相关的,服务启动都是 java 命名的进程

启动完成后浏览器访问查看
Tomcat-目录介绍

#####查看日志

[aaa@qq.com bin]# tail -f /data/application/tomcat/logs/catalina.out
16-Mar-2020 17:08:20.171 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of 
web application directory [/data/application/tomcat/webapps/docs] has finished in [84] ms16-Mar-2020 17:08:20.171 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web 
application directory [/data/application/tomcat/webapps/examples]16-Mar-2020 17:08:21.711 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of 
web application directory [/data/application/tomcat/webapps/examples] has finished in [1,540] ms16-Mar-2020 17:08:21.712 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web 
application directory [/data/application/tomcat/webapps/host-manager]16-Mar-2020 17:08:21.827 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of 
web application directory [/data/application/tomcat/webapps/host-manager] has finished in [115] ms16-Mar-2020 17:08:21.827 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web 
application directory [/data/application/tomcat/webapps/manager]16-Mar-2020 17:08:21.930 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of 
web application directory [/data/application/tomcat/webapps/manager] has finished in [103] ms16-Mar-2020 17:08:21.953 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
16-Mar-2020 17:08:22.117 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
16-Mar-2020 17:08:22.273 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 3709 ms
相关标签: tomcat linux