11 Aug 2013

Apache compression.

Compressing web pages on Apache server

Compress the web pages on Apache server, so the size of the files the client(browser) receives will be reduced (by almost 5 folds).

Follow the configuration to compress the file on apache server.

In the httpd/conf.d/vhosts.conf file in linux add the following lines

# DEFLATE by type - html, text, css, xml
AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml
 

# DEFLATE by type - javascript 
AddOutputFilterByType DEFLATE application/x-javascript application/javascript text/javascript text/x-js text/x-javascript
 

# DEFLATE by extension
AddOutputFilter DEFLATE js css htm html xml

The above lines compresses the file types specified in the #ed lines only(js, css, html, htm, xml and its associated mime types).

This compresses only js, css, html, htm, xml files and its associated mime types. All others will be sent uncompressed.

This compresses for all browsers.

follow this for documentation http://httpd.apache.org/docs/2.2/mod/mod_deflate.html.


No comments:

Post a Comment

Note: only a member of this blog may post a comment.