Zum Inhalt wechseln


Pferdebilder ausmalen




Foto

Server Optimierung durch Aktivierung des Apache2 "Expires-Header"

Geschrieben von joe, 04 May 2010 · 173 Aufrufe


Mit dem Firefox Addon Yslow kann man sehr gut eine Webseite auf Herz und Nieren prüfen. Und so analysierte ich die ausgespuckten Werte und kam zum Ergebnis dass eine Aktivierung der Apache2 "Expires-Header", die Webseiten Reaktionszeit beschleunigen könnte.

Folgendermaßen bin ich dabei vorgegangen:

1. Aktivierung der Module "expires" und "deflate".
a2enmod expires
a2enmod deflate

Hinweis: Einzelene Module lassen sich wenn erwünscht wieder deaktivieren mit
a2dismod expires


2. In der Apache2 folgende Konfiguration Änderung mi dem vi Editor duchführen.
<IfModule mod_expires.c>
 # turn on the module for this directory
 ExpiresActive on
 # set default
 ExpiresDefault "access plus 24 hours"

 # cache common graphics
 ExpiresByType image/jpg "access plus 1 months"
 ExpiresByType image/gif "access plus 1 months"
 ExpiresByType image/jpeg "access plus 1 months"
 ExpiresByType image/png "access plus 1 months"

 # cache CSS
 ExpiresByType text/css "access plus 1 months"

 # cache other filetypes
 ExpiresByType text/javascript "access plus 1 months"
 ExpiresByType application/javascript "access plus 1 months"
</IfModule>

<IfModule mod_deflate.c>
 AddOutputFilterByType DEFLATE text/plain
 AddOutputFilterByType DEFLATE text/html
 AddOutputFilterByType DEFLATE text/xml
 AddOutputFilterByType DEFLATE text/css
 AddOutputFilterByType DEFLATE text/javascript
 AddOutputFilterByType DEFLATE application/xml
 AddOutputFilterByType DEFLATE application/xhtml+xml
 AddOutputFilterByType DEFLATE application/rss+xml
 AddOutputFilterByType DEFLATE application/javascript
 AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

Nach der Apache2 Konfigurationsänderung nicht vergessen den Server neu zu starten mit:
/etc/init.d/apache2 restart





man du bist ja ein genie xD

Joe

Eingefügtes Bild

Durchsuche meinen Blog

Neue Kommentare

3 Besucher online

0 members, 3 guests, 0 anonymous users

Blogs meiner Freunde

Letzte Besucher

Mai 2012

S M D M D F S
  12345
6789101112
13141516 17 1819
20212223242526
2728293031