zoukankan      html  css  js  c++  java
  • apache开启gzip压缩

    1.在httpd.conf中去掉下面的#号
    LoadModule headers_module modules/mod_headers.so
    LoadModule deflate_module modules/mod_deflate.so
    
    (*apahce2.2以后deflate模块默认已经开启了,所以去掉#号会出错。)
     
    2.在httpd.conf文件尾加上
    # mod_deflate
    <IfModule mod_deflate.c>
    DeflateCompressionLevel 6 #压缩率
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/atom_xml
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/x-httpd-php
    AddOutputFilterByType DEFLATE image/svg+xml
    </IfModule>
    

    3.重启apache服务器

     
    4.修改php.ini
    (*php默认不开启zlib整站压缩输出,需要压缩输出使用ob_gzhandler函数,两者只能二选一,否则会出错)
    //开启压缩
    zlib.output_compression = On
    //设置压缩比
    zlib.output_compression_level = 6
    
  • 相关阅读:
    Socket
    字符串,byte,字典转换整理
    1-嵌入式面试题库
    10-FreeRTOS 队列
    9-FreeRTOS API获取任务使用CPU时间
    7-代码区 | 常量区 | 静态区(全局区) | 堆区 | 栈区
    8-FreeRTOS任务API
    7-FreeRTOS时间片进行任务调度
    6-C指针
    用Union体测试处理器大小端
  • 原文地址:https://www.cnblogs.com/jkko123/p/6294736.html
Copyright © 2011-2022 走看看