Benutzer-Werkzeuge

Webseiten-Werkzeuge


de:technik:gzip

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu der Vergleichsansicht

de:technik:gzip [2019/03/30 17:31] (aktuell)
Zeile 1: Zeile 1:
 +====== Gzip im Web ======
  
 +Gzip wird haeufig zum komprimieren von Webseiten verwendet um diese schneller laden zu lassen.
 +
 +==== Gzip in Apache ====
 +Via ''​.htaccess'':​
 +<file htaccess .htaccess>​
 +<​ifModule mod_gzip.c>​
 +mod_gzip_on Yes
 +mod_gzip_dechunk Yes
 +mod_gzip_item_include file .(html?​|txt|css|js|php|pl)$
 +mod_gzip_item_include handler ^cgi-script$
 +mod_gzip_item_include mime ^text/.*
 +mod_gzip_item_include mime ^application/​x-javascript.*
 +mod_gzip_item_exclude mime ^image/.*
 +mod_gzip_item_exclude rspheader ^Content-Encoding:​.*gzip.*
 +</​ifModule>​
 +</​file>​
 +
 +Oder fuer den gesamten Webserver:
 +<file apache2 apache2.conf>​
 +AddOutputFilterByType DEFLATE text/plain
 +AddOutputFilterByType DEFLATE text/html
 +AddOutputFilterByType DEFLATE text/xml
 +AddOutputFilterByType DEFLATE text/css
 +AddOutputFilterByType DEFLATE application/​xml
 +AddOutputFilterByType DEFLATE application/​xhtml+xml
 +AddOutputFilterByType DEFLATE application/​rss+xml
 +AddOutputFilterByType DEFLATE application/​javascript
 +AddOutputFilterByType DEFLATE application/​x-javascript
 +</​file>​
 +
 +
 +==== Gzip in NGINX ====
 +<file nginx nginx.conf>​
 +gzip on;
 +gzip_comp_level 2;
 +gzip_http_version 1.0;
 +gzip_proxied any;
 +gzip_min_length 1100;
 +gzip_buffers 16 8k;
 +gzip_types text/plain text/html text/css application/​x-javascript text/xml application/​xml application/​xml+rss text/​javascript;​
 +
 +# Disable for IE < 6 because there are some known problems
 +gzip_disable "MSIE [1-6].(?​!.*SV1)";​
 +
 +# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
 +gzip_vary on;
 +</​file>​
 +
 +
 +===== Quellen =====
 +[[https://​varvy.com/​pagespeed/​enable-compression.html|varvy.com]]
de/technik/gzip.txt · Zuletzt geändert: 2019/03/30 17:31 (Externe Bearbeitung)