Tomcat 7 GZIP压缩不工作 [英] Tomcat 7 GZIP compression not working

查看:440
本文介绍了Tomcat 7 GZIP压缩不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在tomcat的conf / server.xml文件中添加了以下行以启用gzip压缩,但它不工作。页面仍未解压缩。

I have added the following lines in tomcat's conf/server.xml file to enable gzip compression but its not working. Pages are still uncompressesd.

 <Connector port="8080"
         compression="on"
         compressionMinSize="2048"
         noCompressionUserAgents="gozilla, traviata"
         compressableMimeType="text/html,text/xml,text/plain,text/css,
         text/javascript,text/json,application/x-javascript,
         application/javascript,application/json"/>

有什么想法吗?

推荐答案

如果Tomcat在端口80上由Apache支持,则需要在Apache本身中启用压缩。 Tomcat中的压缩只有在您直接在端口8080上访问它时才会起作用。

If Tomcat is fronted by Apache on port 80, you will need to enable compression in Apache itself. The compression in Tomcat will only work if you access it directly on port 8080.

这篇关于Tomcat 7 GZIP压缩不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆