Search code examples
c++macosapache2gziphttp-compression

I Need Help On Implementing mod_gzip


I'm working on a website that showed in the page source a suggestion to implement gzip compression to help my pages display faster. I have downloaded the zip file for mod_gzip 1.23.26.1a (latest version). I'm running Apache 2.4.14.

The link below is the installation instructions from the zip file. When you look at the section Static integration of mod_gzip it says in step 4 to read file INSTALL. The file is missing so I cannot use them to install mod_gzip.

http://schroepl.net/projekte/mod_gzip/install.htm

Note: When I open the index.hm file from the folder there is no link to the left that displays the install link above. I don't remember how I found that link. There are three makefile files but I have no idea what to do with them because the link gives no details.

I did find this link http://nadeausoftware.com/node/33 where I looked at the Mac steps in the section Enable file compression using mod_gzip. I guess these are valid instructions to implement mod_gzip. I don't know how to perform step 4: Compile the module using the included instructions. The documentation provided in the zip file does not have any compiling instructions that I could find. All I have are .c and .h files in the folder. The few places that I could find instructions were using files that end in .cpp. I don't know what I'm supposed to compile.

I would like to use mod_gzip to help speed up my websites but I don't know where else to find information on how to implement it.


Solution

  • I continued to search but could not find any answers to help me. During my search I found out that mod_deflate was available in apache2. Since there is an old debate between mod_gzip and mod_deflate with no consensus I decided to implement mod_deflate. I added the following statements to my apache config file which will compress all file types except images, files already compresses and pdf files. I have reviewed the log file and it's working well.

    # HTTP compression using mod_deflate
    LoadModule deflate_module ${MODULE_INSTALL_PATH_PREFIX}/usr/libexec/apache2/mod_deflate.so
    <IfModule mod_deflate.c>
    # compress all files types except the following
      SetOutputFilter DEFLATE
      SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|jpg|tif?|bmp|svg)$ \ no-gzip dont-vary
      SetEnvIfNoCase Request_URI \
            \.(?:exe|t?gz|zip|bz2|sit|rar)$ \ no-gzip dont-vary
      SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
      DeflateFilterNote Input input_info
        DeflateFilterNote Output output_info
        DeflateFilterNote Ratio ratio_info
        LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate
        CustomLog /var/log/apache2/deflate_log deflate
    </IfModule>