Linux安装部署Tomcat
代码语言:javascript
复制tar zxvf apache-tomcat-8.5.100.tar.gz -C /usr/local/tomcat
代码语言:javascript
复制touch /usr/local/tomcat/apache-tomcat-8.5.100/bin/setenv.sh
代码语言:javascript
复制vi /usr/local/tomcat/apache-tomcat-8.5.100/bin/setenv.sh
代码语言:javascript
复制# 需要事先安装好JDK,可自行上网找教程
JAVA_HOME=/usr/local/jdk1.8.0_351
CATALINA_HOME=/usr/local/tomcat/apache-tomcat-8.5.100
CATALINA_PID=/usr/local/tomcat/apache-tomcat-8.5.100/bin/tomcat.pid
JAVA_OPTS="-server-Dfile.encoding=UTF-8 -Xms4096m -Xmx4096m-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
代码语言:javascript
复制sed -i "s/8080/8083/g" /usr/local/tomcat/apache-tomcat-8.5.100/conf/server.xml
- //增加tomcat静态资源缓存(
<Resources cachingAllowed="true" cacheMaxSize="262144"/>
)
代码语言:javascript
复制 <WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
#新增的配置
<Resources cachingAllowed="true" cacheMaxSize="262144"/>
代码语言:javascript
复制# 启动tomcat
/usr/local/tomcat/apache-tomcat-8.5.100/bin/startup.sh
# 或者
cd /usr/local/tomcat/apache-tomcat-8.5.100/bin
./startup.sh
# 停止tomcat
/usr/local/tomcat/apache-tomcat-8.5.100/bin/shutdown.sh
# 或者
cd /usr/local/tomcat/apache-tomcat-8.5.100/bin
./shutdown.sh
# 查看日志
tail -f /usr/local/tomcat/apache-tomcat-8.5.100/logs/catalina.out