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.

Why isn't mod_deflate running?

Discussion in 'General Discussion' started by wizzy420, Jul 23, 2008.

  1. wizzy420

    wizzy420 Well-Known Member

    Joined:
    Nov 13, 2007
    Messages:
    125
    Likes Received:
    2
    Trophy Points:
    18
    Why isn't mod_deflate running? [SOLVED]

    So, it's been compiled in via EA.

    When I run httpd -l is shows mod_deflate compiled in

    According to this thread here cPanel says "if it's compiled in, it's on!"

    But when I use the tester at http://whatsmyip.org/mod_gzip_test/ it shows all my Ubuntu servers w/ mod_deflate as being gzip'd, and all my cPanel servers with mod_deflate as being not gzipped.

    Any ideas?
     
    #1 wizzy420, Jul 23, 2008
    Last edited: Jul 24, 2008
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    In that thread, I was addressing if a module would be enabled for all users vs. specific users.

    It is possible to select something in the EasyApache interface and it not wind up in the final compile. Here's how:

    When EasyApache begins the compile process, it performs a dry run. To oversimplify things, anything that fails in the dry run will not be included in the final compile.

    However, it is rare for items we include in the EasyApache interface to fail this dry run so you should have our technical analysts take a look at that for you. You'll find a link for submitting a ticket in my signature.
     
  3. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    It may not be enabled, which is a separate step from being compiled in.
     
  4. wizzy420

    wizzy420 Well-Known Member

    Joined:
    Nov 13, 2007
    Messages:
    125
    Likes Received:
    2
    Trophy Points:
    18
    Here's what I did.

    Open WHM

    Go to Service Configuration -> Apache Setup

    Click on "Include Editor"

    In the "Pre VirtualHost Include" section choose "All Versions"

    Inside the box put in:
    Code:
    <Location />
        AddOutputFilterByType DEFLATE text/html text/plain text/xml text/x-js text/css
    </Location>
    
    Then restart Apache

    That seems to do it :)

    Anyone see anything wrong with this or a better way?

    W
     
  5. wizzy420

    wizzy420 Well-Known Member

    Joined:
    Nov 13, 2007
    Messages:
    125
    Likes Received:
    2
    Trophy Points:
    18
    I wonder if for safety's sake it would be good to wrap the above code with:

    <IfModule mod_deflate.c>
    ....
    </IfModule>
     
  6. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Yes, it is always a good idea to wrap module directives in an IfModule block.
     
  7. hm2k

    hm2k Well-Known Member

    Joined:
    Jul 19, 2005
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    #7 hm2k, Mar 25, 2009
    Last edited: Mar 25, 2009
  8. thobarn

    thobarn Well-Known Member

    Joined:
    Apr 25, 2008
    Messages:
    153
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    sanctum sanctorum
    This is from Apache manual [1]
    What is the MIME type you are trying to compress? Is there an AddType in your apache config for that type? Does the server send correct content-type header without any mods you made (install Live HTTP Headers plug-in for Firefox to see headers sent by the server or one of Paros/WebScarab/Fiddler for any browser).

    Try within <directory> or server context, does it work? Below was from my conf (Apache 2.0) before I swapped to using mod_filter, added via CPanel interface as wizzy420 mentioned below, only in the section pre main include.
    Code:
    <IfModule deflate_module>
    	AddOutputFilterByType DEFLATE text/plain	
    	AddOutputFilterByType DEFLATE text/html
    	AddOutputFilterByType DEFLATE application/xhtml+xml
    	AddOutputFilterByType DEFLATE application/xml
    	AddOutputFilterByType DEFLATE text/xml	
    	AddOutputFilterByType DEFLATE text/css
    	AddOutputFilterByType DEFLATE text/javascript
    	AddOutputFilterByType DEFLATE application/javascript
    	AddOutputFilterByType DEFLATE application/x-javascript
    </IfModule>
    Also note that this directive is deprecated as of Apache 2.1 [1]. You can achieve same result using mod_filter [2].

    [1] http://httpd.apache.org/docs/2.1/mod/core.html#addoutputfilterbytype
    [2] http://httpd.apache.org/docs/2.2/mod/mod_filter.html
     
  9. xvihost

    xvihost Active Member

    Joined:
    Sep 8, 2005
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    I am having a real issue getting mod_deflate to work.

    I have checked that the necessary modules are added to Apache.

    I added these very simple three lines to the Pre (and then Post) VirtualHost Include for All Versions:

    Code:
    <IfModule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/html text/plain text/xml 
    </IfModule>
    Restarted and hoped to see at least the text/html pages being gzip'd, but nothing.

    Tried a few different configs I found online... nothing.

    Also I see reference online to an "Optimize Website" module that should appear in cPanel? I do not see this either.

    Apache 2.2.13 - cPanel 11.24.5-R38506 - WHM 11.24.2 - X 3.9

    Thanks for any light that can be shed on this issue.

    Peace,
    Tom
     
    #9 xvihost, Sep 21, 2009
    Last edited: Sep 21, 2009
  10. trevHCS

    trevHCS Well-Known Member

    Joined:
    Nov 1, 2003
    Messages:
    69
    Likes Received:
    1
    Trophy Points:
    8
    For a quick test it's worth adding something like this to .htaccess on a site.

    Code:
    AddOutputFilterByType DEFLATE text/html text/plain text/xml
    ...so you don't need to restart or anything after each tweak. Then you can test it against the gzip tester from earlier in the thread.

    As for the Cpanel addon, it appears under "software / security" section near the bottom, but this might only apply if it's added by EasyApache (not sure how you compiled Apache). Can't remember changing anything in WHM to enable this and turned it all on pretty recently.

    If you have Firefox, it might be worth checking the headers of a page you expect to be compressed by using Liveheaders especially to make sure that the output is being given the correct mime type. Discovered some oddities from PHP scripts not always sending back quite the right one, even if it was actually text.

    Also wondering with the version you've got in the Apache config if you need to put those each on one line, rather than comma delimited like you can with .htaccess.

    Trev
     
    #10 trevHCS, Sep 23, 2009
    Last edited: Sep 23, 2009
  11. ChrisRHS

    ChrisRHS Well-Known Member

    Joined:
    Jul 12, 2006
    Messages:
    292
    Likes Received:
    5
    Trophy Points:
    18
Loading...

Share This Page