Tomcat常规配置
1. windows下允许,控制台出现中文乱码
修改conf/logging.properties文件,将
java.util.logging.ConsoleHandler.encoding = UTF-8
更改为
java.util.logging.ConsoleHandler.encoding = GBK
2. 删除tomcat/webapps下多余的默认应用,增加安全
(1)webapps下只留一个空的ROOT文件夹,删除多余的其他webapps子目录
(2)修改conf/logging.properties文件
# ## handle 中须要删除的部分,注意后面的符号
# 删除:3manager.org.apache.juli.AsyncFileHandler,
# 删除:4host-manager.org.apache.juli.AsyncFileHandler,
handlers = 1catalina.org.apache.juli.AsyncFileHandler, 2localhost.org.apache.juli.AsyncFileHandler, 3manager.org.apache.juli.AsyncFileHandler, 4host-manager.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
# ## Handler specific properties 中须要删除的部分
# 以下所示是需要删除的
3manager.org.apache.juli.AsyncFileHandler.level = FINE
3manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.AsyncFileHandler.prefix = manager.
4host-manager.org.apache.juli.AsyncFileHandler.level = FINE
4host-manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.
# ## Facility specific properties 中须要删除的部分
# 以下所示是需要删除的
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.AsyncFileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.AsyncFileHandler
3. 设置tomcat,允许罗列文件目录
修改conf\web.xml文件,将listings的值设为true
<servlet>
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
</servlet>