关于apache服务器支持断点续传的一点理解

未结帖
0 562
ajian admin_jim 2017-10-25
悬赏:5飞吻

关于apache服务器支持断点续传的一点理解

默认情况下,当下载文件的时候会开启gzip和chunk。
但是chunk没有Content-Length,而范围响应 206 Partial Content又需要Content-Length,
这样的话要让apache同时支持gzip和断点续传就麻烦了。

解决方案是:
遇到text/plain类型的就启用gzip(apache同时会自动启用chunk)
遇到二进制类型的就不启用gzip(apache同时也就不会启用chunk了)


配置文件修改:
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so

#遇到MIME为text类型的就启用gzip
#遇到其他MIME类型的就不启用gzip
<IfModule mod_deflate.c> 
 #gzip压缩 
 DeflateCompressionLevel 9 
 #SetOutputFilter DEFLATE
 AddOutputFilterByType DEFLATE text/html text/plain

 #DeflateFilterNote Input instream 
 #DeflateFilterNote Output outstream 
 #DeflateFilterNote Ratio ratio 
 #LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate 
 CustomLog logs/deflate_log.log deflate
</IfModule>


#开启Accept-Ranges响应头
<IfModule mod_headers.c>
 Header set Accept-Ranges bytes
</IfModule>


热忱回答0


最近热帖

近期热议

  1. javascript——prototype与__proto 9
  2. Mysql 中出现的Data truncated for column 3
  3. 在nginx中使用x-sendfile的解决方案 3
  4. 高版本jQuery面插件实现Ajax上传图片 1
  5. Thinkphp Socket.class.php 类的使用 1
  6. 使用ionic3创建第一个App 0
  7. ios-oc html5 0
  8. nginx.conf 0
  9. 基于ionic3.4.0的项目搭建 0
  10. php 缩略图 0