Archive for April, 2008

Apr 22 2008

Beschleunigung

Published by admin under Linux

Damit sich Web-Seiten schneller anfühlen, gibt es mehrere Möglichkeiten. Zum einen liefert man den Seitenquelltext gepackt über die Leitung aus:
# cat conf.d/gzip.conf
<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>

Zum anderen macht es Sinn, dass einige Inhalte beim Client im Speicher gehalten werden. Man kann dies auch erzwingen. Was schon mal da ist, braucht also nicht neu geladen zu werden. Das macht man mit dem mod_expire von Apache, in etwa so:

ExpiresActive On
ExpiresDefault A300
ExpiresByType image/gif "access plus 1 weeks"
ExpiresByType image/png "access plus 1 weeks"
ExpiresByType image/jpg "access plus 1 weeks"
ExpiresByType image/jpeg "access plus 1 weeks"
ExpiresByType text/css "access plus 1 weeks"
ExpiresByType text/javascript "access pluss 1 weeks"

Dies kommt natürlich in eine Directory-Section oder in eine virtual host-section.

No responses yet