- Tomcat官网
- Tomcat下载地址
https://tomcat.apache.org/download-80.cgi
- 安装Tomcat
[[email protected] tools]# wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.20/bin/apache-tomcat-8.5.20.tar.gz [[email protected] tools]# tar xf apache-tomcat-8.5.20.tar.gz [[email protected] tools]# ls apache-tomcat-8.5.20 apache-tomcat-8.5.20.tar.gz [[email protected] tools]# mv apache-tomcat-8.5.20 /usr/local/tomcat8
- 启动Tomcat
[[email protected] tools]# cd /usr/local/tomcat8/ [[email protected] tomcat8]# ls bin conf lib LICENSE logs NOTICE RELEASE-NOTES RUNNING.txt temp webapps work [[email protected] tomcat8]# bin/startup.sh Using CATALINA_BASE: /usr/local/tomcat8 Using CATALINA_HOME: /usr/local/tomcat8 Using CATALINA_TMPDIR: /usr/local/tomcat8/temp Using JRE_HOME: /usr/local/jdk1.8.0_131 Using CLASSPATH: /usr/local/tomcat8/bin/bootstrap.jar:/usr/local/tomcat8/bin/tomcat-juli.jar Tomcat started. [[email protected] tomcat8]# netstat -nlput | grep java tcp 0 0 :::8080 :::* LISTEN 2396/java tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 2396/java tcp 0 0 :::8009 :::* LISTEN 2396/java [[email protected] tomcat8]# ps -ef | grep java root 2396 1 12 15:51 pts/0 00:00:02 /usr/local/jdk1.8.0_131/bin/java -Djava.util.logging.config.file=/usr/local/tomcat8/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -classpath /usr/local/tomcat8/bin/bootstrap.jar:/usr/local/tomcat8/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat8 -Dcatalina.home=/usr/local/tomcat8 -Djava.io.tmpdir=/usr/local/tomcat8/temp org.apache.catalina.startup.Bootstrap start root 2446 2278 0 15:51 pts/0 00:00:00 grep java
- 访问网站
[[email protected] tomcat8]# curl -I localhost:8080 HTTP/1.1 200 Content-Type: text/html;charset=UTF-8 Transfer-Encoding: chunked Date: Wed, 16 Aug 2017 07:52:49 GMT
- Tomcat目录介绍
[[email protected] tomcat8]# yum -y install tree [[email protected] tomcat8]# pwd /usr/local/tomcat8 [[email protected] tomcat8]# tree -L 1 . ├── bin #用以启动、关闭Tomcat或者其它功能的脚本(.bat文件和.sh文件) ├── conf #用以配置Tomcat的XML及DTD文件 ├── lib #存放web应用能访问的JAR包 ├── LICENSE ├── logs #日志存放目录 ├── NOTICE ├── RELEASE-NOTES ├── RUNNING.txt ├── temp #临时文件 ├── webapps #Web应用程序根目录 └── work #用以产生有JSP编译出的Servlet的.java和.class文件 7 directories, 4 files [[email protected] tomcat8]# cd webapps/ [[email protected] webapps]# ll total 20 drwxr-x--- 14 root root 4096 Aug 16 15:49 docs #Tomcat帮助文档 drwxr-x--- 6 root root 4096 Aug 16 15:49 examples #web应用实例 drwxr-x--- 5 root root 4096 Aug 16 15:49 host-manager #管理 drwxr-x--- 5 root root 4096 Aug 16 15:49 manager #管理 drwxr-x--- 3 root root 4096 Aug 16 15:49 ROOT #默认网站根目录
- Tomcat日志
[[email protected] webapps]# cd /usr/local/tomcat8/logs/ [[email protected] logs]# ll total 24 -rw-r----- 1 root root 6107 Aug 16 15:51 catalina.2017-08-16.log -rw-r----- 1 root root 6107 Aug 16 15:51 catalina.out -rw-r----- 1 root root 0 Aug 16 15:51 host-manager.2017-08-16.log -rw-r----- 1 root root 280 Aug 16 15:51 localhost.2017-08-16.log -rw-r----- 1 root root 819 Aug 16 15:52 localhost_access_log.2017-08-16.txt -rw-r----- 1 root root 0 Aug 16 15:51 manager.2017-08-16.log
- Tomcat配置文件
[[email protected] logs]# cd /usr/local/tomcat8/conf/ [[email protected] conf]# pwd /usr/local/tomcat8/conf [[email protected] conf]# ll -h total 228K drwxr-x--- 3 root root 4.0K Aug 16 15:51 Catalina -rw------- 1 root root 14K Aug 3 05:36 catalina.policy -rw------- 1 root root 7.3K Aug 3 05:36 catalina.properties -rw------- 1 root root 1.4K Aug 3 05:36 context.xml -rw------- 1 root root 1.2K Aug 3 05:36 jaspic-providers.xml -rw------- 1 root root 2.4K Aug 3 05:36 jaspic-providers.xsd -rw------- 1 root root 3.6K Aug 3 05:36 logging.properties -rw------- 1 root root 7.4K Aug 3 05:36 server.xml #主配置文件 -rw------- 1 root root 2.2K Aug 3 05:36 tomcat-users.xml #Tomcat管理用户配置文件 -rw------- 1 root root 2.6K Aug 3 05:36 tomcat-users.xsd -rw------- 1 root root 165K Aug 3 05:36 web.xml
时间: 2024-10-11 12:00:31