LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > Focused4Success
User Name
Password

Notices


Rate this Entry

Using gzip Compression in Apache to Serve Pages Faster

Posted 11-07-2010 at 07:13 AM by Focused4Success
Updated 11-07-2010 at 07:15 AM by Focused4Success

Enabling gzip compression in Apache will dramatically reduce the amount of data transmitted. This is easily accomplished by doing the following as root:

cd /etc/apache2
cat <<\! > httpd.conf.local
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \
\.(?:exe|t?gz|zip|bz2|sit|rar|7z)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary

BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
!

vi /etc/sysconfig/apache2
Make the following changes:
APACHE_CONF_INCLUDE_FILES="/etc/apache2/httpd.conf.local"
APACHE_MODULES="... deflate"

Restart apache
/etc/init.d/apache2 restart

Test your website for speed improvement.
Views 8942 Comments 1
« Prev     Main     Next »
Total Comments 1

Comments

  1. Old Comment
    Apache to Serve Pages Faster...
    how gzip can make it faster for apache I wonder?

    by the way for a faster serving you might want to try out nginx.
    Posted 11-07-2010 at 07:24 AM by Web31337 Web31337 is offline
    Updated 11-07-2010 at 07:25 AM by Web31337
 

  



All times are GMT -5. The time now is 12:58 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration