java - 在 tomcat 7 中启用 mod_deflate?

标签 java tomcat amazon-web-services

关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。












想改进这个问题?将问题更新为 on-topic对于堆栈溢出。

7年前关闭。




Improve this question




我正在尝试关注 this tutorial用于在 Tomcat 7 上启用 mod_deflate。

它提供了一个名为 enable_mod_deflate.conf 的文件。 , 它想复制到 /etc/http.d/enable_mod_deflate.conf .我已经这样做了,但是当我重新启动 Tomcat 时,我没有在我的 javascript 文件中看到 gzip header 。

这些是我的enable_mod_deflate.conf的内容文件:

<IfModule mod_deflate.c>
# Restrict compression to these MIME types
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xml+rss
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE image/png
AddOutputFilterByType DEFLATE image/gif
AddOutputFilterByType DEFLATE image/jpeg

# Level of compression (Highest 9 - Lowest 1)
DeflateCompressionLevel 9

# Netscape 4.x has some problems.
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

<IfModule mod_headers.c>
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>

</IfModule> 

我错过了什么吗?

最佳答案

是的,你错过了一些东西。

Tomcat 和 Apache 是两个独立的服务。通常 Apache 被配置为代理对 tomcat 的请求。但是如果你对 apache 配置进行了更改,你需要重新启动 apache。

关于java - 在 tomcat 7 中启用 mod_deflate?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24844047/

相关文章:

java - 一般来说,为 Tomcat REST 服务配置合理的最大线程数限制,还是将其设置为有效的无限值,哪个更好?

amazon-web-services - 无法删除包含错误字符的 Amazon S3 key

Java和xpath - xHtml解析问题

java - 在 Java 中的数据库之间切换

java - 在 JSF 页面中以段落形式列出 Iterate

java - 使用 java 1.6 时在 tomcat 上出现错误 filterStart

tomcat - 当我尝试部署 servlet 应用程序时 netbeans 出错?

amazon-web-services - 在AWS托管中的安全组中设置动态IP?

amazon-web-services - AWS 数据管道 : Tez fails on simple HiveActivity

Java XML 解析 - 递归查找元素