Sunday, March 20, 2011

Mod_gzip As HTTP Compressor

What is mod_gzip?

mod_gzip is an external extension module that serves to compress the apache http output to speed delivery of text or html to ten-fold when compared with no compression.

Mod_gzip As the name implies, this module uses gzip compression method that is able to reduce shipping volume of a website through http protocol. The advantage of using mod_gzip which I feel is:

1. Minimize the bandwidth of the output from a website, especially a website that has a bandwidth limit per month.
2. Allows speed up access to a website, so people with small bandwidth speeds can access the website comfortably.

May arise questions of yourself Can I use mod_gzip? As the title above mod_gzip usually used in Apache 1.3, while for the Apache version 2 uses mod_deflate.

The next question probably crossed your mind is how the application of this mod_gzip?

Certainly do not be too difficult, just need to read a manual apache and mod_gzip some tutorials about it you can apply it directly.

Beginning with the installation of apache, mod_gzip and apache pengconfigurasian so mod_gzip can be used.

In the tutorial pack budsz ever discussed about the method to support mod_gzip apache installation. This time I will present on how to install via the ports collection

First, log into your machine as root.

indofreebsd # cd / usr/ports/www/apache13 /; make install clean
indofreebsd # cd / usr / ports / www / mod_gzip; make install clean

last edit your httpd.conf and make sure the module is loaded gzip

LoadModule gzip_module libexec / apache /

and add this directive at the end of your httpd.conf:
< IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_can_negotiate Yes
mod_gzip_static_suffix .gz
AddEncoding gzip .gz
mod_gzip_update_static No
mod_gzip_command_version '/mod_gzip_status'
mod_gzip_keep_workfiles No
mod_gzip_minimum_file_size 0
mod_gzip_maximum_file_size 1000000
mod_gzip_maximum_inmem_size 100000
mod_gzip_min_http 1000
mod_gzip_handle_methods GET POST
mod_gzip_item_exclude reqheader "User-agent: Mozilla/4.0[678]"
mod_gzip_item_include file \.htm$
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.shtml$
mod_gzip_item_include file \.shtm$
mod_gzip_item_include file \.jsp$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include file \.cgi$
mod_gzip_item_include mime text/.*
mod_gzip_item_include mime ^application/x-httpd-php
mod_gzip_item_include mime httpd/unix-directory
mod_gzip_item_include handler ^perl-script$
mod_gzip_item_include handler ^server-status$
mod_gzip_item_include handler ^server-info$
mod_gzip_item_exclude file .css$
mod_gzip_item_exclude file .js$
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_include mime ^text/html$
mod_gzip_item_include mime ^text/plain$
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_item_exclude mime ^image/
mod_gzip_dechunk Yes
LogFormat "%h %l %u %t \"%V %r\" %< s %b mod_gzip: %{mod_gzip_result}n In:%{mod_gzip_input_size}n -< Out:%{mod_gzip_output_size}n = %{mod_gzip_compression_ratio}n pct." common_with_mod_gzip_info2
CustomLog /var/log/mod_gzip.log common_with_mod_gzip_info2
mod_gzip_add_header_count Yes
mod_gzip_send_vary Yes
< /ifModule>
then save your httpd.conf and make apache to be run every time you reboot

add this to your rc.conf

apache_enable = "YES"

indofreebsd # / usr / local / etc / rc.d / start
Starting apache.

Please test your mod_gzip with accessing or using the web site or software like mod_gzip Test

So hopefully useful glimpse of mod_gzip.


Ogeb Gustav