..
1. Introducing Deflate
Among the many modules available for the Web Server Apache may be interesting to deepen DEFLATE whose purpose is to compress the output before it is sent to the client as a response to requests, in some cases this procedure allows a considerable saving on the bandwidth available to connect not by chance "to deflate" in English means "deflated".
Compression implemented by this module is allowed thanks to a special filtering procedure output that can be activated through use of the directive SetOutputFilter with a syntax like this:
SetOutputFilter DEFLATEOf course you may need to enable compression only for certain types of files, to do this we have another directive, which accepts as a parameter called AddOutputFilterByType a particular MIME type.
In the following we will see how to force compression DEFLATE form at just the HTML content within a given folder:
<Directory "/root-del-server/nome-cartella"> AddOutputFilterByType DEFLATE text / html </ Directory>The output of the compression is achieved using the gzip algorithm, but it can not be managed in the best way by different browsers exist, in some cases it is good then introduce a new directive, BrowserMatch, through which intercept the type of browser used by the client and disable the DEFLATE filter through gzip or no-argument gzip-only-text/html education.
"No-gzip" compression to exclude the activity of the browser shown in the container (group instruction in httpd.conf configuration file of Apache), "gzip-only-text/html" is instead follow a more refined because it allows the action of the DEFLATE filter only for the specified MIME types.
For example:
# Enable compression only for certain # MIME types in Netscape 4.x BrowserMatch ^ Mozilla / 4 gzip-only-text/html # Disable compression for the version of 4:06 to 4:08 BrowserMatch ^ Mozilla / 4 \ .0 [678] no-gzip # Enable compression for browsers # Internet Explorer "masked" by Netscape BrowserMatch \ bMSIE! No-gzip! Gzip-only-text/htmlAs you can see, DEFLATE is a very flexible module that adapts well to different situations that must be handled by the Web Server, but it is good to know that compression is made before sending the output and after its production, then the module will not affect the operation of any server side applications.
Of course, in addition to the guidelines for the compression of the output, DEFLATE also offers instructions for decompression of the inputs, so the band can be saved in both directions of transmission.
The main directive for the decompression SetInputFilter that can be specified as follows:
<Location /percorso> SetInputFilter DEFLATE </ Location>The statement indicated he will act, if the compression is supported requests from the client, of all those documents that present among the other headers header
Content-Encoding: gzipindicating the transmission of a compressed file.
| |
Linux (Course)
Complete guide to open-source system. From 49 €. |
| |
MySQL (Course)
Management of open-source database. From 39 €. |
| |
PHP (Course)
Full course for creating dynamic Web sites. From 49 €. |