zoukankan      html  css  js  c++  java
  • 使用mod_deflate模块压缩页面优化传输速度

    在HTTPD主配置文件中添加如下,并确保deflate模块是启用的

    #vim /etc/httpd/conf/httpd.conf

           SetOutputFilter DEFLATE//调用一个叫DEFLATE输出过滤器

           # mod_deflate configuration

                 

           # 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/x-javascript

           AddOutputFilterByType DEFLATE text/javascript

           AddOutputFilterByType DEFLATE text/css

                   

           # 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 MSI[E] !no-gzip !gzip-only-text/html

    然后#service httpd reload

    #cp /etc/rc.d/rc.sysinit /vhosts/web1/htdocs/test.html     //vhosts/web1/htdocs这个目录是提前创建的

    #curl -I http://192.160.108.160/test.html  //查看响应报文的首部

    #curl -I --compressed http://192.160.108.160/test.html

    可以看出调用的压缩功能以后,响应报文首部的内容长度是原来的三分之一

  • 相关阅读:
    R 误差自相关与DW检验
    R WLS矫正方差非齐《回归分析与线性统计模型》page115
    R 再也不用愁变量太多跑回归太麻烦!R语言循环常用方法总结
    R 读取回归模型的信息
    R 创建一个空的数据框
    R 《回归分析与线性统计模型》page93.6
    自编函数
    ntpdate 正确的做法
    利用yum升级Centos6的gcc版本,使其支持C++11
    Python Shell 中敲击方向键显示「^[[C^[[D],问题解决
  • 原文地址:https://www.cnblogs.com/hanshanxiaoheshang/p/9139431.html
Copyright © 2011-2022 走看看