apache_conf 启用压缩

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf 启用压缩相关的知识,希望对你有一定的参考价值。

<IfModule mod_deflate.c>

    <IfModule mod_setenvif.c>
        <IfModule mod_headers.c>
            SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
            RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
        </IfModule>
    </IfModule>
    
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE "application/atom+xml" \
          "application/javascript" \
          "application/json" \
          "application/ld+json" \
          "application/manifest+json" \
          "application/rdf+xml" \
          "application/rss+xml" \
          "application/schema+json" \
          "application/vnd.geo+json" \
          "application/vnd.ms-fontobject" \
          "application/x-font-ttf" \
          "application/x-javascript" \
          "application/x-web-app-manifest+json" \
          "application/xhtml+xml" \
          "application/xml" \
          "font/collection" \
          "font/eot" \
          "font/opentype" \
          "font/otf" \
          "font/ttf" \
          "image/bmp" \
          "image/svg+xml" \
          "image/vnd.microsoft.icon" \
          "image/x-icon" \
          "text/cache-manifest" \
          "text/calendar" \
          "text/css" \
          "text/html" \
          "text/javascript" \
          "text/plain" \
          "text/markdown" \
          "text/vcard" \
          "text/vnd.rim.location.xloc" \
          "text/vtt" \
          "text/x-component" \
          "text/x-cross-domain-policy" \
          "text/xml"
    </IfModule>
    
    <IfModule mod_mime.c>
        AddEncoding gzip svgz
    </IfModule>
    
</IfModule>

以上是关于apache_conf 启用压缩的主要内容,如果未能解决你的问题,请参考以下文章

apache_conf 启用GZIP压缩

apache_conf 启用GZIP压缩(.htaccess)

apache_conf 启用GZIP压缩#optimization #gzip #htaccess

apache_conf 通过启用gzip压缩来提高页面速度。在WordPress中添加到.htaccess

apache_conf gzip压缩压缩

apache_conf 启用浏览器缓存