Tomcat7下配置gzip
server.xml 找到
1 <Connector port="8080" protocol="HTTP/1.1"
2 connectionTimeout="20000"
3 redirectPort="8443" />
2 connectionTimeout="20000"
3 redirectPort="8443" />
替换成
1 <Connector port="8080" protocol="HTTP/1.1"
2 connectionTimeout="20000"
3 redirectPort="8443"
4 compression="on"
5 compressionMinSize="2048"
6 noCompressionUserAgents="gozilla,traviata"
7 compressableMimeType="text/html,text/xml,text/css,text/plain,text/javascript,application/x-javascript,application/javascript" />
2 connectionTimeout="20000"
3 redirectPort="8443"
4 compression="on"
5 compressionMinSize="2048"
6 noCompressionUserAgents="gozilla,traviata"
7 compressableMimeType="text/html,text/xml,text/css,text/plain,text/javascript,application/x-javascript,application/javascript" />