关闭。这个问题不符合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/