Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I know that my site is not sending data gzipped. I tested that using site like

Now I want to know if apache is compiled with gzip module or not. Before I put in the code that will serve the compressed content I want to test if gzip is enabled on my apache server or do I need to build it. How do I test that. How do I put a debug statement that will show up in apache log. I believe I can do something like this but not sure.

 <IfModule mod_gzip.c>  
   log('apache is configured with gzip. no need to install it')  

What code will go in place of log so that I could see the message in apache log. Also how can I write else statement so that I get a message either way.

Here is my apache.conf

# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

# Include all the user configurations:
Include /etc/apache2/httpd.conf

# Include ports listing
Include /etc/apache2/ports.conf

This is the list of items in mods-enabled directory

root@me:/etc/apache2/mods-enabled# ls
alias.conf       authn_file.load       authz_host.load  autoindex.load  dir.load   mime.load         setenvif.conf  status.load
alias.load       authz_default.load    authz_user.load  cgi.load        env.load   negotiation.conf  setenvif.load
auth_basic.load  authz_groupfile.load  autoindex.conf   dir.conf        mime.conf  negotiation.load  status.conf
share|improve this question

3 Answers 3

up vote 2 down vote accepted

try running from command line:

apache2 -l

this should give you list of modules built into apache. more probably you'll have gzip as additional loadable module called - check if any of your .load loads this one.

if you use debian'ish distro [ it seems so ] just symlink deflate.load and deflate.conf from mods-available to mods-enabled:

cd /etc/apache2/mods-enabled/
ln -s ../mods-available/deflate.load
ln -s ../mods-available/deflate.conf

and reload apache2

/etc/init.d/apache2 reload
share|improve this answer

Check the output of :

httpd -M 2<&1 | grep gzip


share|improve this answer
root@eiiv2:/etc/apache2/mods-available# httpd -bash: httpd: command not found –  Roger Aug 26 '09 at 21:45
This would be for RedHat or CentOS –  Myles May 15 at 4:40

I'm assumming Apache 2.....Just because the deflate module is present, does not necessarily imply that output compression happens. It is necessary to add the directive where you want output to be gzipped:

SetOutputFilter DEFLATE

There are other options so that only certain types of files are gzipped as well.

I'd suggest that you might look at the deflate module description in

share|improve this answer
I just setup the symlink and now gzip test by and indicates that content is indeed zipped. I did not set SetOutputFilter DEFLATE Could you please explain why this directive is needed and why even without that directive I am getting my content zipped. The site is . –  Roger Aug 27 '09 at 3:22
When I implemented this feature, I had to include this directive otherwise the output did not arrive in zipped form for the browser. The description of the module is at: Hope this helps –  mdpc Aug 27 '09 at 4:08
Thanks mdpc. That helps. One last question. I have four vhosts in my apache config. vhost config is like this <VirtualHost xx.xx.xx.xx:80> ServerName xxxxxx ServerAlias xxxxxxxxxx DocumentRoot /home/xxxx/current/public <Directory "/home/xxx/current/public"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost> I was wondering if I need to put <Location /> ... <Location> inside the vhost config which means I will repeast same info 4 times or can I put the same code at a global level just before vhost declaration –  Roger Aug 27 '09 at 4:30
Also there is an end of element tag at the very first line. <Location /> And then there is end of tag at the bottom </Location>. Is <Location /> a typo. Should it be <Location> ? –  Roger Aug 27 '09 at 4:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.