Recommended sites

Add to MyYahoo!
Subscribe in NewsGator Online
Add to Newsburst
Add to Google
Add to My AOL
Add to Pluck
Subscribe in FeedLounge
Add to Windows Live
Add to NetVibes
Subscribe in Rojo
Subscribe in Bloglines
Add to MyMSN
Add to Plusmo for your cellphone
Add to PageFlakes
Add to Technorati
Add to BlinkBits
Speed up your apache server with mod_deflate Print E-mail
User Rating: / 0
PoorBest 
Sunday, 25 February 2007 22:15

Since I am facing performance problem due to the load of visitors and a badly configured server, I decide today to document my findings in this new series of articles.

The mod_deflate module provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network.

Server: Strato (www.strato.de)
Operating system: SuSE / openSuSE
Requirements: root access and basic Unix knowledge

Why installing mod_deflate? is PHP gzip not enough?
PHP Gzip only compress PHP output, not unical file, like CSS, Javascipt, fixed HTML, other ressources.

1 Use yast2 to install mod_deflate on the system, this will create files (*.so) in   /usr/lib/apache2-worker/ and  /usr/lib/apache2-prefork/
2 Edit the file  
# vi /etc/sysconfig/apache2

and add deflate and headers (optional A)
APACHE_MODULES="deflate headers access actions alias auth auth_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl   userdir php4 php5 perl     rewrite suexec"
3 create a new file in /etc/apache2/conf.d/mod_deflate.conf

#vi /etc/apache2/conf.d/mod_deflate.conf


and add these lines, at the end of file, adapt all path according to your system.

<IfModule mod_deflate.c>
  # place filter 'DEFLATE' on all outgoing content
  #SetOutputFilter DEFLATE
  AddOutputFilterByType DEFLATE text/html text/plain text/xml

  # exclude uncompressible content via file type
  SetEnvIfNoCase Request_URI \.(?:gif|jpeg|jpg|png|rar|zip)$ no-gzip dont-vary
  SetEnvIfNoCase Request_URI \.(?:mpg|avi|mpeg|wmv|mp3|wma|ogg)$ no-gzip dont-vary
  <IfModule mod_headers.c>
    #
A properly handle requests coming from behind proxies
    Header append Vary User-Agent
  </IfModule>

  # deflate.log, log compression ratio on each request
  DeflateFilterNote Input instream
  DeflateFilterNote Output outstream
  DeflateFilterNote Ratio ratio
  LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
  CustomLog /var/log/apache2/deflate.log deflate

  # Properly handle old browsers that do not support compression
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
</IfModule>
 
4 start
# apache2-reconfigure-mpm
this recreate the file  /etc/apache2/sysconfig.d/loadmodule.conf
and restart apache automatically.
verification: View HTTP Request and Response Header with http://web-sniffer.net/

search for Content-Encoding: gzip

References:
Comments
Add New Search RSS
Write comment
Name:
Email:
 
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
:):grin;)8):p:roll:eek:upset:zzz:sigh:?:cry
:(:x
Please input the anti-spam code that you can read in the image.

3.20 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated ( Tuesday, 27 February 2007 22:27 )
 


Another articles:


Content View Hits : 2426201

Enter Amount: