The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Compression not working

Discussion in 'EasyApache' started by rregister, Sep 7, 2016.

  1. rregister

    rregister Member

    Joined:
    Aug 10, 2015
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    I'm having trouble getting compression working on a VPS server for a client. I've enabled "compress all content" from inside the individual account cpanel. I can confirm that this is properly adding the following code to the .htaccess file in the account root.

    Code:
    <IfModule mod_deflate.c>
        SetOutputFilter DEFLATE
        <IfModule mod_setenvif.c>
            # 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 \bMSIE !no-gzip !gzip-only-text/html
           
            # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
            # the above regex won't work. You can use the following
            # workaround to get the desired effect:
            BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
           
            # Don't compress images
            SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
        </IfModule>
       
        <IfModule mod_headers.c>
            # Make sure proxies don't deliver the wrong content
            Header append Vary User-Agent env=!dont-vary
        </IfModule>
    </IfModule>
    Under "Tweak settings" > "Compression", I have the default settings.

    I can also confirm that the package "ea-apache24-mod_deflate" is installed in my current easyapache 4 config.

    I'm little puzzled because I've never encountered this issue before... it always just worked out of the box. Any advice would be appreciated!
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,811
    Likes Received:
    671
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    You can use the following command after uploading a test file to the domain name to verify if the content is compressed:

    Code:
    curl -v --compressed http://www.test.domain/test.html
    Could you run this command and let us know the output?

    Thank you.
     
  3. rregister

    rregister Member

    Joined:
    Aug 10, 2015
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    Code:
    > GET /test.html HTTP/1.1
    > Host: [intentionally excluded]
    > User-Agent: curl/7.43.0
    > Accept: */*
    > Accept-Encoding: deflate, gzip
    >
    < HTTP/1.1 200 OK
    < Date: Wed, 07 Sep 2016 18:15:53 GMT
    < Server: Apache
    < Last-Modified: Wed, 07 Sep 2016 18:14:31 GMT
    < Accept-Ranges: bytes
    < Content-Length: 26
    < Vary: User-Agent
    < Cache-Control: max-age=31536050
    < Content-Type: text/html
    I initially noticed the problem when using google's pagespeed test, but I've also used sites like http://www.whatsmyip.org/http-compression-test and they return the same result . Thanks for your help!
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,811
    Likes Received:
    671
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome.

    Thank you.
     
  5. rregister

    rregister Member

    Joined:
    Aug 10, 2015
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    Thanks for the quick response, Michael.

    Support Request ID is: 7653411
     
  6. rregister

    rregister Member

    Joined:
    Aug 10, 2015
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Texas
    cPanel Access Level:
    Root Administrator
    Issue resolved. For anyone wondering, because I used easyapache4 with muti php, I needed to add

    Code:
    output_handler = Off
    zlib.output_compression = On
    zlib.output_handler = ob_gzhandler
    to the specific php.ini file (in my case php7). Just enabling compression was not enough to get it working with php files.
     
Loading...

Share This Page