世界那么好,机会那么多

这里除了干货,什么都没有

tomcat8 性能优化

环境:Linux,tomcat8 

1,配置优化

若需登录系统,必须配置tomcat用户,在安装完Tomcat后,进行以下操作:

1.1  在/conf/tomcat-users.xml文件中的<tomcat-users>标签里面添加如下内容

<!-- 修改配置文件,配置tomcat的管理用户 -->
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="admin"/>
<role rolename="admin-gui"/>
<user username="tomcat" password="tomcat" roles="admin-gui,admin,manager-gui,manager" />

1.2  如果是tomcat7,配置了tomcat用户就可以登录系统了

但 tomcat8 中不行,还需要修改另一个配置文件,否则访问不了,提示403。打开webapps/manager/META-INF/context.xml文件进行编辑

<!-- 将Valve标签的内容注释掉,保存退出即可 -->
<?xml version="1.0" encoding="UTF-8"?>
<Context antiResourceLocking="false" privileged="true" >

<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve" 
    allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->

<Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context>

浏览器打开localhost:端口,访问

 

 

点击“Server Status”,输入用户名、密码进行登录,tomcat/tomcat 

 

 

posted @ 2020-03-19 11:52  面向对象爱好者社区  阅读(185)  评论(0编辑  收藏  举报