tomcat 常用配置
(1)Linux中支持软连接
编辑conf/context.xml,增加 allowLinking="true"
<Context reloadable="true" allowLinking="true">
(2)禁止通过 telnet localhost 8005 SHUTDOWN关闭tomcat
修改conf/service.xml文件, 8005改成-1
<Server port="-1" shutdown="SHUTDOWN">
(3)设置URL编码,防止get请求时,参数中文乱码
修改conf/server.xml
增加: URIEncoding="UTF-8"
<Connector port="8084" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" server="IIS Server" compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain" />
(4)传输压缩
在进行网络传输时, 进行静态文件等压缩处理
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" compression="on" compressionMinSize1="2048" noCompressionUserAgents="gozilla, traviata" compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain"/>
参考:https://www.itjh.net