This repository has been archived by the owner on Mar 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
|
||
basic | ||
nginx | ||
tomcat | ||
net-traversal | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
|
||
|
||
tomcat | ||
======== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: 目录: | ||
|
||
tomcat/关于Tomcat | ||
tomcat/[Ubuntu 16.02]Tomcat9安装 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
|
||
# [Ubuntu 16.02]Tomcat9安装 | ||
|
||
参考: | ||
|
||
[Ubuntu16.04安装Tomcat](https://blog.csdn.net/ItJavawfc/article/details/87370956) | ||
|
||
[Ubuntu16.04服务器安装tomcat](https://blog.csdn.net/Shezzer/article/details/84074133) | ||
|
||
## 预安装 | ||
|
||
`Tomcat`需要预先安装`JDK`,并设置环境变量 | ||
|
||
``` | ||
export JAVA_HOME=/home/zj/software/java/jdk1.8.0_201 | ||
export JRE_HOME=$JAVA_HOME/jre | ||
``` | ||
|
||
## 下载 | ||
|
||
当前最新版本:`Tomcat 9.0.27`。下载地址:[Tomcat 9 Software Downloads](https://tomcat.apache.org/download-90.cgi) | ||
|
||
## 配置 | ||
|
||
解压到`/opt`目录下,修改环境变量配置文件`/etc/profile`,增加 | ||
|
||
``` | ||
# Tomcat | ||
export CATALINA_HOME=/opt/apache-tomcat-9.0.27 | ||
export CATALINA_BASE=/opt/apache-tomcat-9.0.27 | ||
``` | ||
|
||
## 启动 | ||
|
||
执行文件`/bin/startup.sh`,即可启动`Tomcat` | ||
|
||
``` | ||
# ./startup.sh | ||
Using CATALINA_BASE: /opt/apache-tomcat-9.0.27 | ||
Using CATALINA_HOME: /opt/apache-tomcat-9.0.27 | ||
Using CATALINA_TMPDIR: /opt/apache-tomcat-9.0.27/temp | ||
Using JRE_HOME: /home/zj/software/java/jdk1.8.0_201/jre | ||
Using CLASSPATH: /opt/apache-tomcat-9.0.27/bin/bootstrap.jar:/opt/apache-tomcat-9.0.27/bin/tomcat-juli.jar | ||
Tomcat started. | ||
``` | ||
|
||
查询`localhost:8080`是否已被监听 | ||
|
||
``` | ||
# curl localhost:8080 | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title>Apache Tomcat/9.0.27</title> | ||
... | ||
... | ||
``` | ||
|
||
![](./imgs/tomcat-8080.png) | ||
|
||
## 停止 | ||
|
||
调用脚本`/bin/shutdown.sh` | ||
|
||
## 开机自启动 | ||
|
||
修改文件`/etc/rc.local` | ||
|
||
``` | ||
#!/bin/sh -e | ||
# | ||
# rc.local | ||
# | ||
# This script is executed at the end of each multiuser runlevel. | ||
# Make sure that the script will "exit 0" on success or any other | ||
# value on error. | ||
# | ||
# In order to enable or disable this script just change the execution | ||
# bits. | ||
# | ||
# By default this script does nothing. | ||
/opt/apache-tomcat-9.0.27/bin/startup.sh | ||
exit 0 | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
# 关于Tomcat | ||
|
||
`Tomcat`文档在开头提供了一些重要的信息和内容 - [Introduction](https://tomcat.apache.org/tomcat-9.0-doc/introduction.html#CATALINA_HOME_and_CATALINA_BASE) | ||
|
||
## 术语 | ||
|
||
具体规范参考:[Servlet and JSP specifications](https://wiki.apache.org/tomcat/Specifications)。比如 | ||
|
||
* `Context` - 表示一个`Web`应用程序 | ||
|
||
## 目录和文件 | ||
|
||
重要的`tomcat`目录: | ||
|
||
1. `/bin`:启动、关闭以及其他一些脚本 | ||
2. `/conf`:配置文件和相关的`DTDs`,其中最重要的配置文件就是`server.xml` | ||
3. `/logs`:默认放置的日志目录 | ||
4. `/webapps`:`webapp`存放的目录 | ||
|
||
## CATALINA_HOME和CATALINA_BASE | ||
|
||
需要设置两个重要的环境变量: | ||
|
||
1. `CATALINA_HOME`:表示`Tomcat`安装路径 | ||
2. `CATALINA_BASE`:表示特定`Tomcat`实例的运行时配置的根路径 | ||
|
||
默认情况下,两个环境变量设置为相同路径 |