Compress your pages in Gzip and test results

Last update on November 16, 2009 12:19 PM by deri58
Published by jak58

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.

Compressing web pages on the fly


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:

<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_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 \.css$
   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
</IfModule>


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/mod_gzip.so



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

Test the Gzip compression


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:
Best answers for « Compress your pages in Gzip and test results » in :
Download Check4Change Show Web pages have to be put in day manually so that changes can see each other real-time. For instance on a page showing sports results. Then to avoid having to click on the button at all times "update", prefer automatic method. Chek4Change is a program...
Compress / decompress a ZIP FILE Show Compress / decompress a ZIP FILE ZIP files are specifically used under Microsoft Windows. Under Linux, the compression format is GZip (.Gz) format or Tarball(.Tar.gz). You can compress and decompress ZIP files with zip / unzip,...
[Memory] Using Windows Memory Test Show [Memory] Using Windows Memory Test Creating bootable media Running the test Simplified interpretation of results Notes Windows Memory Test is a utility to test the RAM units of a PC. It works regardless of operating system. Creating...
Google: Number of Results ShowGoogle: Number of Results Number Of Results When doing a research with Google search engine, you will get by default 10 results displayed on the results page. If you wish to extend the number of results on that page, there is an easy...
How to test your computer's power supply ShowHow to test your computer's power supply To be able to test your computer's power supply, you can follow the instructions below: 1. Turn off your power switch and plug it out from the power supply. 2. Remove the cable from the CPU and start...
Displaying images in web browser ShowDisplaying images in web browser The Flash / Shockwave not displayed When surfing on the internet, you have surely come across small rectangles with red crosses replacing images on the web pages. This may be due to several images on...
Download PagePlus ShowPagePlus is a desktop publishing software that enables you to create stunning documents for your home, school, business or club - no experience required! With PagePlus you can create outstanding greetings cards, flyers, banners and posters with easy...
Download US Yellow Pages ShowTo search information of location on a person, the quickest means is to consult the telephone book notably the yellow pages. US Yellow Pages is online version to consult the yellow pages in States Unis. All states are represented with departments to...
HTML forms ShowForms Interactive forms let web page authors give their pages interactive elements, such as for receiving messages from their readers, much like the reply cards found in some magazines. The reader enters information by filling in fields or clicking...
Managing images in HTML ShowHow do you display images on a web page? Having a few images on a website can make it more attractive and user-friendly. However, it is important not to go overboard, since images can take a long time to load, and in some cases can make a document...