APACHE启用gzip压缩模块大幅提升网…

1:修改httpd.conf配置文件

开启以下三个模块mod_deflate.somod_headers.somod_expires.so

(开启方法去掉最前面的#号注释即可,默认已开启


2:在配置最底下增加以下配置信息            

 

    SetOutputFilter DEFLATE   

    SetEnvIfNoCase Request_URI .(?:gifjpe?gpng)$ no-gzip dont-vary

    SetEnvIfNoCase Request_URI .(?:exet?gzzipbz2sitrar)$ no-gzip dont-vary

    SetEnvIfNoCase Request_URI .(?:pdfmovavimp3mp4rm)$ no-gzip dont-vary

    AddOutputFilterByType DEFLATE text/*

    AddOutputFilterByType DEFLATE application/ms* application/vnd* application/postscript application/javascript application/x-javascript

    AddOutputFilterByType DEFLATE application/x-httpd-php application/x-httpd-fastphp

    BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.x

    BrowserMatch ^Mozilla/4.0[678] no-gzip # Netscape 4.06-4.08

    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    Header append Vary User-Agent env=!dont-vary

 

 

 

    ExpiresActive On

    ExpiresDefault A604800

    ExpiresByType text/css A3600

    ExpiresByType text/html A3600

    ExpiresByType application/x-javascript A3600

    ExpiresByType image/gif "access plus 2 month"

    ExpiresByType image/jpeg "access plus 2 month"

    ExpiresByType image/png "access plus 2 month"

    ExpiresByType image/x-icon "access plus 2 month"

    ExpiresByType application/x-shockwave-flash A2592000

    ExpiresByType text/css M3600 

    Header unset Pragma

    FileETag None

    Header unset ETag

   

       #Header set Expires "Thu, 15 Apr 2013 20:00:00 GMT"

       Header unset Last-Modified

       Header append Cache-Control "public"

  

 

 

3重启APACHE(/etc/init.d/httpd restart)

4验证有没有开启

APACHE启用gzip压缩模块大幅提升网络加载速度设定方法



IIS7的参考:http://msdn.microsoft.com/zh-cn/ff695514.aspx(默认开启)

IIS6的参考:http:///article/a3aad71a8d13c3b1fb0096e9.html


发布了145 篇原创文章 · 获赞 40 · 访问量 16万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览