当前位置: 首页 > 知识库问答 >
问题:

无法启用压缩(deflate/gzip)

锺离嘉茂
2023-03-14
# 1
<ifModule mod_gzip.c>  
mod_gzip_on Yes  
mod_gzip_dechunk Yes  
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$  
mod_gzip_item_include handler ^cgi-script$  
mod_gzip_item_include mime ^text/.*  
mod_gzip_item_include mime ^application/x-javascript.*  
mod_gzip_item_exclude mime ^image/.*  
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*  
</ifModule>  
# 2
# compress text, HTML, JavaScript, CSS, and XML
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

# remove browser bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
# 3
<ifmodule mod_deflate.c>
# Insert filter
SetOutputFilter DEFLATE

# 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 \bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary

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

共有1个答案

爱炯
2023-03-14

这种奇怪行为的原因--对通过.htaccess-file压缩的不同方法完全没有反应--是托管公司:他们关闭了入门级托管的mod_gzip-模块(我有)。他们的解决方案:购买下一个层次!

谢谢你的提示,Cubitouch!

向你问好,弗拉德

 类似资料:
  • DEFLATE 是同时使用了哈夫曼编码(Huffman Coding)与 LZ77 算法的一个无损数据压缩算法,是一种压缩数据流的算法。任何需要流式压缩的地方都可以用。目前 zip 压缩文件默认使用的就是该算法。 关于算法的原理,以及 哈夫曼编码(Huffman Coding)与 LZ77 算法,感兴趣的读者可以查询相关资料,这里推荐 GZIP压缩原理分析——第五章 Deflate算法详解 序列文

  • 本文向大家介绍Nodejs关于gzip/deflate压缩详解,包括了Nodejs关于gzip/deflate压缩详解的使用技巧和注意事项,需要的朋友参考一下 0x01.关于 写http时候,在接收http请求时候,出现乱码,后来发现是gzip没有解压。 关于gzip/deflate压缩,有放入管道压缩,和非管道压缩方法。 0x02.管道压缩 Node中的I/O是异步的,因此对磁盘和网络的读写需要

  • 我有一个Spring启动应用程序使用webSocket和跺脚协议。自从我移动到Spring引导启动父版本1.3.0。M2我注意到一个额外的压缩头在webSocket握手,即。 Sec WebSocket扩展:permessage deflate 这一切对我来说都很好,但我希望在运行开发构建时有机会禁用此标头。当该头存在时,wireshark stomp堵塞似乎有问题。因此,问题是如何在扩展WebS

  • 假设我有一个可重复的模式,比如4个随机字节、4个可预测字节、4个新的随机字节、4个相同的可预测字节的随机数据,等等。这个东西放气能压缩好吗? 4个字节是否太短而不能很好地压缩? deflate是否内置支持这样的交错可压缩/不可压缩数据? 是否有其他常见的压缩格式更好地处理这种模式?

  • 我得到无效的zip,当写入文件以下代码: 我将其写入文件的方式是: 我做错了什么?

  • 我试图启用gzip压缩的组件我的网站。我有ubuntu 11.04服务器和nginx 1.2。 在网站的nginx配置中,我有以下内容 Yslow和谷歌的速度测量建议我使用gzip来减少网络传输。现在,当我尝试时,我得到了 是否知道我做错了什么,或者我应该做什么来获得压缩内容?