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

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

  • 相关阅读:
    luogu 1169 棋盘制作(单调栈/悬线)
    poj 2769 感觉♂良好 (单调栈)
    hdu 5033 buiding(单调栈)
    hdu1506 直方图中最大的矩形 单调栈入门
    有线电视网(树形dp)
    洛谷P1220 关路灯(区间dp)
    【题解】NOI2009二叉查找树 + NOIP2003加分二叉树
    【题解】AHOI2009中国象棋
    【算法】Matrix
    【题解】WC2008游览计划
  • 原文地址:https://www.cnblogs.com/hanshanxiaoheshang/p/9139431.html
Copyright © 2011-2022 走看看