how to check mod_deflate is enabled in apache?
Asked Answered
C

6

29

Is there a command line command that can tell whether or not mod deflate is running on Apache?

Cottonmouth answered 9/6, 2009 at 13:38 Comment(3)
In what context? The web server config, a cgi script...?Hospital
A command... where? In htaccess? Please be more specific.Hysterics
All that can answer to the point is a good answerCottonmouth
S
38

It is probably to late, but here we go.

mod_deflate is enabled per default. To be sure, try

debian / ubuntu: apache2ctl -t -D DUMP_MODULES

CentOS: httpd -t -D DUMP_MODULES

and look if there is a deflate_module.

Spitsbergen answered 5/7, 2010 at 9:42 Comment(1)
I had to use just 'apachectl' without the '2'.Lecithinase
P
29

You can verify mod_deflate with this site:

mod_deflate test

My site gets a nice little report that shows I'm saving 81% of my bandwidth!

Pierrette answered 9/6, 2009 at 13:51 Comment(1)
This tool tests whether either mod_gzip, deflate or any other compression tool is working on the server, not just mod_deflate.Buoy
T
7

You'll want to make sure the following line is present (and not commented out) in your apache configuration (httpd.conf):

LoadModule deflate_module modules/mod_deflate.so

The commented out version looks like:

# LoadModule deflate_module modules/mod_deflate.so

Then to have it deflate files as they are served, you'll need a line in your .htaccess, like this:

AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript
Team answered 9/6, 2009 at 13:43 Comment(2)
Seems this module is automatically built-in if there is --enable-deflate option.Cottonmouth
@karim79, I cannot find httpd.conf, my apache's version 2.4?Yemane
S
5

I agree with the comments 'in what context' but to cover all bases (in addition to the other responses) you may also be able to run;

a2enmod deflate

This should work on many servers that run Apache (especially Debian based ones), in the event the module is already enabled the command will tell you, if the module isn't enabled the command will enable it. It may also tell you that the module doesn't exist in which case you will need to install it.

Sibie answered 9/6, 2009 at 14:49 Comment(0)
A
0

You can view all modules loaded in Apache with this command:

apache2ctl -M
Advocaat answered 22/12, 2020 at 10:5 Comment(0)
T
-1

Like said, we need precisions.

If you're using debian, you can enable this mode like this.

//List all available mods
cd /etc/apache2/mods-avaliable

//Enable module - if you need to enable another module, just replace "deflate"
a2enmod deflate

//restart apache
service apache2 restart

//Check that module is effectively enabled
cd /etc/apache2/mods-enabled

ls -al

That's all for linux debian environment.

Tokoloshe answered 4/6, 2014 at 16:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.