TOC
历史
- 6.0 2007-02-28 First Apache Tomcat release to support the Servlet 2.5, JSP 2.1, and EL 2.1 specifications.
- 7.0 2011-01-14 First Apache Tomcat release to support the Servlet 3.0, JSP 2.2, EL 2.2, and WebSocket specifications.
- 8.0 2014-06-25 First Apache Tomcat release to support the Servlet 3.1, JSP 2.3, and EL 3.0 specifications.
- 8.5 2016-06-13 Adds support for HTTP/2, OpenSSL for JSSE, TLS virtual hosting and JASPIC 1.1. Created from Tomcat 9, following delays to Java EE 8.
- 9.0 2018-01-18 First Apache Tomcat release to support the Servlet 4.0 specifications.
- 10.0 First Apache Tomcat release to support the Servlet 5.0, JSP 3.0, EL 4.0, WebSocket 2.0 and Authentication 2.0 specifications.
参考
安装
1 | cd ~/download |
下载地址
- apache-tomcat-7.0.109.tar.gz
https://archive.apache.org/dist/tomcat/tomcat-7/v7.0.109/bin/apache-tomcat-7.0.109.zip - 归档版本
运行
Maven Plugin
Exploded web application
Jetbrains
设置JVM
编辑 setenv.sh
Linux
1 | # 设置使用的JVM |
Windows
1 | set JAVA_HOME=/usr/local/java/jdk1.8 |
配置
server.xml 基本配置
1 | <?xml version='1.0' encoding='utf-8'?> |
tomcatThreadPool
1 | <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="200" minSpareThreads="150" maxIdleTime="20000"/> |
默认值
1 | connectionTimeout = 20000 |
Logging
参考
虚拟host配置
1 | <Service name="Catalina"> |
多实例部署
配置和执行文件分开,tomcat安装目录仅留下bin和lib目录,instance目录下放原conf,新建bin
,logs
,webapps
,work
空目录
instance/bin 创建 start-instance.sh
1 | export CATALINA_HOME=/usr/local/tomcat/tomcat7 |
instance/bin 创建 stop-instance.sh
1 | export CATALINA_HOME=/usr/local/tomcat/tomcat7 |
参考
- Running multiple instances of Tomcat with single server installation
- Run and Configure Multiple Instances in a Single Tomcat Server
Performance
设置Jasper development为false
Is Jasper used in development mode? If true, the frequency at which JSPs are checked for modification may be specified via the modificationTestInterval parameter.
编辑 conf/web.xml
1 | <servlet> |
jconsole 远程监控
jconsole 192.168.137.59:9000
1 | CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=192.168.137.59" |