Compress your pages in Gzip and test results

One of the main qualities of a website is fast loading. But it depends on the size of Web pages and their components. There are a number of techniques to reduce the overall size downloaded by the user.

The HTTP protocol provides a mechanism to compress web pages on the fly for the Mariners. To implement this compression, it usually takes to install a module on the server and configure it. Under the browser Apache, the module is the most used mod_gzip. Here is a sample configuration for this module:

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_temp_dir /tmp mod_gzip_keep_workfiles No mod_gzip_minimum_file_size 500 mod_gzip_maximum_file_size 500000 mod_gzip_maximum_inmem_size 60000 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 .html$ mod_gzip_item_include file .htm$ mod_gzip_item_include file .php3$ mod_gzip_item_include file .php$ mod_gzip_item_include file .js$ mod_gzip_item_include file ss$ mod_gzip_item_include mime ^text/ mod_gzip_item_exclude mime ^httpd/unix-directory mod_gzip_item_exclude mime ^image/ mod_gzip_dechunk Yes mod_gzip_add_header_count Yes mod_gzip_send_vary Yes

Note that: It is also necessary to add mod_gzip to the list of modules installed by inserting the following line last in the list, because the Gzip compression should intervene at the end of the process:

LoadModule gzip_module /usr/lib/apache/1.3/

Then we must reload the Apache configuration for example by running one of the following:

apachectl graceful killall -HUP apache /etc/init.d/apache reload > /dev/null

Once the new Apache configuration taken into account, you can not easily check if compression is taken into account, since the web browsers (Firefox, IE, Opera, etc..) Handle the completely transparent.

Thus, it is necessary to look at the HTTP headers exchanged between the server and browser. For this there are online tools ready for use:

Source of the article:

click this link to see more

Leave A Comment