Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何为Apache2.4启用gzip?_Javascript_Apache_Gzip - Fatal编程技术网

Javascript 如何为Apache2.4启用gzip?

Javascript 如何为Apache2.4启用gzip?,javascript,apache,gzip,Javascript,Apache,Gzip,我用官方帮助文档为gzip创建了一个配置文件,但它不起作用。我使用Apache2.4版本 <IfModule mod_deflate.c> <filesMatch "\.(js|html|css)$"> SetOutputFilter DEFLATE </filesMatch> DeflateCompressionLevel 9 # Accurate Logging DeflateFilterNote Input

我用官方帮助文档为gzip创建了一个配置文件,但它不起作用。我使用Apache2.4版本

<IfModule mod_deflate.c>
   <filesMatch "\.(js|html|css)$">
      SetOutputFilter DEFLATE
   </filesMatch>

   DeflateCompressionLevel 9

   # Accurate Logging
   DeflateFilterNote Input instream
   DeflateFilterNote Output outstream
   DeflateFilterNote Ratio ratio

   LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
   CustomLog logs/deflate_log DEFLATE

   Header append Vary: User-Agent
</IfModule>

SetOutputFilter放气
放气压缩级别9
#精确测井
放气过滤器注流输入
放气过滤器注输出超出流
排气过滤比
LogFormat“%r”%%{outstream}n/%%{instream}n(%%{ratio}n%%)”放气
自定义日志/deflate\u日志deflate
标题:用户代理
我还尝试使用下一个配置,但也不起作用:

<IfModule mod_deflate.c>
   # Force deflate for mangled headers
   <IfModule mod_setenvif.c>
      <IfModule mod_headers.c>
         SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
         RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
      </IfModule>
   </IfModule>
   <IfModule mod_filter.c>
      FilterDeclare   COMPRESS
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'text/html'"
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'text/css'"
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'text/plain'"
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'text/xml'"
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'text/x-component'"
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/javascript'"
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/json'"
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/xml'"
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/xhtml+xml'"
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/rss+xml'"
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/atom+xml'"
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/vnd.ms-fontobject'"
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'image/svg+xml'"
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'image/x-icon'"
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/x-font-ttf'"
      FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'font/opentype'"
      FilterChain     COMPRESS
      FilterProtocol  COMPRESS  DEFLATE change=yes;byteranges=no
   </IfModule>
   <IfModule !mod_filter.c>
      # Legacy versions of Apache
      AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
      AddOutputFilterByType DEFLATE application/javascript
      AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
      AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
      AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
   </IfModule>
</IfModule>

#对损坏的收割台强制放气
SetEnvIfNoCase^((gzip | deflate)\s*,?\s*)+|[X~-]{4,13}$有接受编码
RequestHeader追加接受编码“gzip,deflate”env=HAVE_Accept-Encoding
FilterDeclare压缩
FilterProvider COMPRESS DEFLATE“%{Content_Type}='text/html'”
FilterProvider COMPRESS DEFLATE“%{Content_Type}='text/css'”
FilterProvider Compresse DEFLATE“%{Content_Type}='text/plain'”
FilterProvider COMPRESS DEFLATE“%{Content_Type}='text/xml'”
FilterProvider Compresse DEFLATE“%{Content_Type}='text/x-component'”
FilterProvider COMPRESS DEFLATE“%{Content_Type}='application/javascript'”
FilterProvider COMPRESS DEFLATE“%{Content_Type}='application/json'”
FilterProvider Compresse DEFLATE“%{Content_Type}='application/xml'”
FilterProvider Compresse DEFLATE“%{Content_Type}='application/xhtml+xml'”
FilterProvider COMPRESS DEFLATE“%{Content_Type}='application/rss+xml'”
FilterProvider Compresse DEFLATE“%{Content_Type}='application/atom+xml'”
FilterProvider Compresse DEFLATE“%{Content_Type}='application/vnd.ms fontobject'”
FilterProvider Compresse DEFLATE“%{Content_Type}='image/svg+xml'”
FilterProvider压缩放气“%{Content_Type}='image/x-icon'”
FilterProvider Compresse DEFLATE“%{Content_Type}='application/x-font-ttf'”
FilterProvider Compresse DEFLATE“%{Content\u Type}='font/opentype'”
过滤链压缩
过滤器协议压缩放气变化=是;byteranges=否
#Apache的遗留版本
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
AddOutputFilterByType DEFLATE应用程序/javascript
AddOutputFilterByType DEFLATE text/xml应用程序/xml文本/x组件
AddOutputFilterByType DEFLATE应用程序/xhtml+xml应用程序/rss+xml应用程序/atom+xml
AddOutputFilterByType DEFLATE image/svg+xml应用程序/vnd.ms-fontobject应用程序/x-font-ttf font/opentype

我期待着
encodecontent:gzip
头响应请求:
example.com/test.js
,但我没有看到它。

什么是“不工作”的意思?我没有看到
encodecontent:gzip
头响应请求:什么是“不工作”的意思是?我没有看到响应请求的
encodecontent:gzip
标题: