Skip to content

Apache 2: Caching & gzip

Marvin Menzerath edited this page Aug 1, 2017 · 1 revision

Einrichtung von Caching und gzip-Komprimierung auf einem Apache 2 Webserver.

Caching

vHost Konfiguration

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 days"
    ExpiresByType text/html "access plus 14 days"
    ExpiresByType text/css "access plus 7 days"
    ExpiresByType application/javascript "access plus 7 days"
    ExpiresByType image/gif "access plus 1 months"
    ExpiresByType image/jpg "access plus 1 months"
    ExpiresByType image/jpeg "access plus 1 months"
    ExpiresByType image/png "access plus 1 months"
</IfModule>

Terminal

root@www:~# a2enmod expires
root@www:~# apachectl configtest
Syntax OK
root@www:~# systemctl reload apache2.service

gzip

vHost Konfiguration

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css application/javascript
</IfModule>

Terminal

root@www:~# a2enmod deflate
root@www:~# apachectl configtest
Syntax OK
root@www:~# systemctl reload apache2.service

Quelle: http://codebeerstartups.com/2012/10/how-to-set-an-expires-header-in-apache/