2012-09-15 2 views
1

gzip 압축을 사이트 lavenderdiamond.net/home에서 작동 시키려고합니다. .htaccess에 다음 코드를 추가했지만 내 사이트에서 제공되는 파일은 압축되지 않습니다. 또한 서버에서 mod_deflate가 활성화되어 있는지 확인했습니다. 여기에 코드입니다 :Apache (Dreamhost)에서 HTTP 압축 100 %가 아님

# ---------------------------------------------------------------------- 
# Gzip compression 
# ---------------------------------------------------------------------- 

<IfModule mod_deflate.c> 

    # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/ 
    <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> 

    # Compress all output labeled with one of the following MIME-types 
    <IfModule mod_filter.c> 
    AddOutputFilterByType DEFLATE application/atom+xml \ 
            application/javascript \ 
            application/json \ 
            application/rss+xml \ 
            application/vnd.ms-fontobject \ 
            application/x-font-ttf \ 
            application/xhtml+xml \ 
            application/xml \ 
            font/opentype \ 
            image/svg+xml \ 
            image/x-icon \ 
            text/css \ 
            text/html \ 
            text/plain \ 
            text/x-component \ 
            text/xml 
    </IfModule> 

</IfModule> 

나는 문제가 그들의 편에있는 경우 DreamHost는 오픈 지원 티켓을 가지고,하지만 난 궁금 다른 사람들은 문제가 점점 압축이 일반적으로 사용 가능, 또는 특히 DreamHost는에 있었다합니다. 또한 아파치의 가능한 문제를 디버깅하는 방법을 아는 데 매우 익숙하지 않습니다. 오류 메시지를 여기에서보고 잘못 될 수있는 방법을 알 수있는 방법이 있습니까? 어떤 도움을 주시면 감사하겠습니다!

답변

4

이 문제도 발생했습니다. Dreamhost를 사용하여 호스팅 한 이전 웹 사이트를 확인하고 파일이 올바르게 압축되어 있음을 확인하여 관련 (이전) H5P .htaccess 청크를 최신 웹 사이트로 복사 했으므로 이제 작동합니다.

다음과 "IfModule mod_filter.c"덩어리 교체 :

# HTML, TXT, CSS, JavaScript, JSON, XML, HTC: 
<IfModule filter_module> 
    FilterDeclare COMPRESS 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $image/x-icon 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf 
    FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype 
    FilterChain  COMPRESS 
    FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no 
</IfModule> 

<IfModule !mod_filter.c> 
    # Legacy versions of Apache 
    AddOutputFilterByType DEFLATE text/html text/plain text/css application/json 
    AddOutputFilterByType DEFLATE application/javascript 
    AddOutputFilterByType DEFLATE text/xml application/xml text/x-component 
    AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml 
    AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype 
</IfModule>