Subject: Step 3) Enable GZIP compression to speed up your web page
Author: WebSpider
In response to: Step 2) Use Keep-Alive to avoid excess connections
Posted on: 12/14/2011 02:16:41 AM
Compress everything except images
<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
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !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>
Request Header:
GET /css/layout.css HTTP/1.1
Accept-Encoding: gzip, deflate
Response Header:
HTTP/1.1 200 OK
Content-Encoding: gzip
>
> On 12/10/2011 02:10:56 PM
WebSpider wrote:
Keep-Alive is active only with files where the length is known beforehand. This means that most CGI scripts, server-side included files and directory listings will not use the Keep-Alive protocol.
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15
Request Header:
GET /css/layout.css HTTP/1.1
Connection: Keep-Alive
Response Header:
HTTP/1.1 200 OK
Content-Length: 1408
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
References: