How to Use Data Compression On Web Pages – Apache
Apache also has the ability to dynamically compress static Web pages into gzip format and then send the result to the remote Web surfers’ Web browser. Most current Web browsers support this format, transparently uncompressing the data and presenting it on the screen. This can significantly reduce bandwidth charges if you are paying for Internet access by the megabyte.
First you need to load Apache version 2′s deflate module in your httpd.conf file and then use Location directives to specify which type of files to compress. After making these modifications and restarting Apache, you will be able to verify from your /var/log/httpd/access_log file that the sizes of the transmitted HTML pages have shrunk.
Compare the file sizes in this Apache log.
[root@ bigboy tmp]# grep dns-static /var/log/httpd/access_log ... ... 67.119.25.115 - - [15/Feb/2003:23:06:51 -0800] "GET /dns-static.htm HTTP/1.1" 200 15190 "http://www.linuxhomenetworking.com/sendmail.htm" "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0; AT&T CSM6.0; YComp 5.0.2.6)" ... ... [root@ bigboy tmp]#
and the corresponding directory listing
[root@ bigboy tmp]# ll /web-dir/dns-static.htm -rw-r--r-- 1 user group 78350 Feb 15 00:53 /home/www/ccie/dns-static.htm [root@bigboy tmp]#
As you can see, 78,350 bytes shrunk to 15,190 bytes, that’s almost 80% compression.
Compression Configuration Example
You can insert these statements just before your virtual hosting section of your httpd.conf file to activate the compression of static pages. Remember to restart Apache when you do.
Note: Fedora’s version of httpd.conf loads the compression module mod_deflate by default. This means that the LoadModule line (the first line of the example snippet) is not required for Fedora. The location statements are required, however.
LoadModule deflate_module modules/mod_deflate.so
<Location />
# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</Location>apache, bandwidth charges, compress, configuration example, configure, directory, format, group, httpd, images, listing, logs, virtualizer, Windows
5 Responses to “How to Use Data Compression On Web Pages – Apache”
Leave a Reply Cancel reply
Categories
- Alerts & News
- Android
- Anti-Malware
- Anti-Spam/Virus
- Anti-Spyware
- Anti-Virus
- Apache
- Archiving
- Articles
- Audio and Video
- AWS
- Backup
- Backup
- Braindumps
- Browsers
- Browsers and Plugins
- Build Tools
- Cacti
- CentOS
- Cisco
- Cisco IOS Command Reference
- Citrix NetScaler
- Cleaning and Tweaking
- Clustering
- Clustering
- Compilers
- Data recovery
- Database
- Database
- Databases
- Debuggers
- Dell
- Dell
- Desktops
- Developer
- DHCP
- DNS
- Drivers Download
- Drupal
- Editors
- Encryption Software
- Exchange Server
- Fedora
- File Management
- firefox
- Firefox Add-ons
- Firewall
- Free ebooks
- Free software downloads
- Free Tools
- FTP
- FTP
- Games
- Google Plus
- Graphics
- Hacking
- Hardware
- Help Desk software
- High-Availability
- HP
- HP
- IIS
- Interpreters
- iphone
- IT-Tips
- LAMP
- Languages
- Laptops
- Latest Product & Technologies
- Linux
- Linux Commands
- Load Balancer
- Mac
- Memcached
- Messaging and Chat
- miscellaneous
- Mobile Development
- Mobiles
- Monitoring
- MySQL
- NAS
- Networking
- Networking
- Networking Software
- Office and News
- Open Source
- OpenSource Applications
- openSUSE
- Oracle
- PHP
- Popular downloads
- PostgreSQL
- Project Management Software
- Qmail
- Red Hat
- Remote Access
- Repository
- Sci-Tech Education
- Security
- Security
- Sendmail
- SEO
- SEO Tools
- Server OS
- Service Pack
- social networking
- Software Development
- solr
- SQL
- Squid
- Storage
- Sun Solaris
- System Tuning
- Tech Guru
- Technology News
- Testing
- Ubuntu
- Utilities
- Version Control
- Video Tutorial
- Virtual Machine Applications
- Virtualization
- VoIP
- VPN
- Web-related
- web-related
- Websense
- Website Promotion
- Windows
- Windows Commands
- Zend Studio
Recent Posts
- The best memcached Monitoring tool
- Is Thin Clients are Useful for Call center ?
- A new Email Service from Microsoft called Outlook.com
- How to Detect Back Links from spam websites
- How to Ignore Replication errors in MySQL

Want to jump your google rank? http://tiny.cc/iioeuw
please go to the websites we adhere to, which includes this one, because it represents our picks in the web
below you
below you will come across the link to some web-sites that we believe you need to visit
although websites we backlink to below are considerably not related to ours, we feel they may be actually worth a go by, so possess a look