tachtler:apache_http_server_centos_7_-_mod_deflate_-_komprimierte_kommunikation
no way to compare when less than two revisions
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
— | tachtler:apache_http_server_centos_7_-_mod_deflate_-_komprimierte_kommunikation [2016/12/05 14:26] (aktuell) – angelegt klaus | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== Apache HTTP Server CentOS 7 - mod_deflate - Komprimierte Kommunikation ====== | ||
+ | |||
+ | Das [[http:// | ||
+ | |||
+ | Siehe auch nachfolgenden **externen Link**: | ||
+ | * **[[http:// | ||
+ | |||
+ | ===== Vorbereitungen ===== | ||
+ | |||
+ | Das [[http:// | ||
+ | |||
+ | :!: **HINWEIS** - Beim Einsatz des | ||
+ | * [[http:// | ||
+ | sollten auch die Module | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | **geladen** werden, wie nachfolgend gezeigt: | ||
+ | |||
+ | Konfigurationsdatei: | ||
+ | < | ||
+ | ... | ||
+ | LoadModule deflate_module modules/ | ||
+ | LoadModule headers_module modules/ | ||
+ | LoadModule headers_module modules/ | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | ===== Konfiguration ===== | ||
+ | |||
+ | Nachfolgendes **Beispiel**, | ||
+ | <code apache> | ||
+ | ... | ||
+ | < | ||
+ | # Place filter ' | ||
+ | SetOutputFilter DEFLATE | ||
+ | # Exclude uncompressible browser via part of user-agent string | ||
+ | BrowserMatch ^Mozilla/4 gzip-only-text/ | ||
+ | BrowserMatch ^Mozilla/ | ||
+ | BrowserMatch \bMSIE !no-gzip !gzip-only-text/ | ||
+ | # Exclude uncompressible content via file type | ||
+ | < | ||
+ | SetEnvIfNoCase Request_URI \.(?: | ||
+ | </ | ||
+ | < | ||
+ | # Properly handle requests coming from behind proxies | ||
+ | Header append Vary User-Agent | ||
+ | </ | ||
+ | </ | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | **__Erklärungen__**: | ||
+ | |||
+ | Aktivieren des **Filters** - DEFLATE - im **Container** dem diese Anweisung enthalten ist. Hier ist das die Anweisung **''< | ||
+ | <code apache> | ||
+ | SetOutputFilter DEFLATE | ||
+ | </ | ||
+ | |||
+ | Ausschluss von bestimmten Browsern, welche **Probleme** mit der Komprimierung von Inhalten haben. Je nach Browser, welcher über **'' | ||
+ | <code apache> | ||
+ | BrowserMatch ^Mozilla/4 gzip-only-text/ | ||
+ | BrowserMatch ^Mozilla/ | ||
+ | BrowserMatch \bMSIE !no-gzip !gzip-only-text/ | ||
+ | </ | ||
+ | |||
+ | Schließt die in der URI angeforderten Datei-Typen von der Komprimierung aus. Dies macht bei Datei-Typen sinn, welche bereits selbst ein komprimiertes Format aufweisen. | ||
+ | <code apache> | ||
+ | < | ||
+ | SetEnvIfNoCase Request_URI \.(?: | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Das [[http:// | ||
+ | * '' | ||
+ | an z.B. zwischengeschaltete **Proxy-Server**. | ||
+ | |||
+ | Dies bewirkt, dass eine zwischengespeicherte Antwort nur an Clients/ | ||
+ | * '' | ||
+ | senden, komprimiert ausgeliefert wird. | ||
+ | |||
+ | Dadurch wird verhindert, dass komprimierte Inhalte an einen Clients/ | ||
+ | |||
+ | Nachfolgendes Beispiel, bezieht sich auf die Angabe im **'' | ||
+ | <code apache> | ||
+ | < | ||
+ | # Properly handle requests coming from behind proxies | ||
+ | Header append Vary User-Agent | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ==== Anpassung LOG-Auswertung ==== | ||
+ | |||
+ | Das [[http:// | ||
+ | |||
+ | Nachfolgendes Beispiel zeigt wie die bestehende LOG-Direktive des [[http:// | ||
+ | |||
+ | **__Standard__**: | ||
+ | <code apache> | ||
+ | ... | ||
+ | LogFormat "%h %l %u %t \" | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | **__Erweitert__**: | ||
+ | <code apache> | ||
+ | ... | ||
+ | DeflateFilterNote Input instream | ||
+ | DeflateFilterNote Output outstream | ||
+ | DeflateFilterNote Ratio ratio | ||
+ | LogFormat "%h %l %u %t \" | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Entsprechend muss nun auch die Angabe, wie geloggt werden soll entsprechend im Host/VHost angepasst werden. | ||
+ | |||
+ | **__Standard__**: | ||
+ | <code apache> | ||
+ | ... | ||
+ | | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | **__Erweitert__**: | ||
+ | <code apache> | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Nachfolgend ein kurzer Verglich, **ohne** die veränderte Log-Ausgabe | ||
+ | < | ||
+ | 88.217.171.167 - - [05/ | ||
+ | " | ||
+ | </ | ||
+ | und **mit** | ||
+ | < | ||
+ | 88.217.171.167 - - [05/ | ||
+ | " | ||
+ | </ | ||
+ | |||
+ | Siehe auch nachfolgenden **externen Link**: | ||
+ | * **[[http:// | ||
+ | |||
+ | ===== Test ===== | ||
+ | |||
+ | Um zu sehen, ob die Seiten auch entsprechend komprimiert, | ||
+ | * **'' | ||
+ | |||
+ | Nachfolgender Aufruf der Webseite [[http:// | ||
+ | < | ||
+ | # curl -v -o /dev/null http:// | ||
+ | </ | ||
+ | |||
+ | **__Ergebnis__**: | ||
+ | < | ||
+ | * About to connect() to www.dokuwiki.tachtler.net port 80 (#0) | ||
+ | * | ||
+ | * Connected to www.dokuwiki.tachtler.net (88.217.171.167) port 80 (#0) | ||
+ | > GET /doku.php HTTP/1.1 | ||
+ | > User-Agent: curl/7.19.7 (i386-redhat-linux-gnu) libcurl/ | ||
+ | libidn/1.18 libssh2/ | ||
+ | > Host: www.dokuwiki.tachtler.net | ||
+ | > Accept: */* | ||
+ | > | ||
+ | % Total % Received % Xferd Average Speed | ||
+ | | ||
+ | 0 | ||
+ | < Date: Thu, 28 Mar 2013 15:18:14 GMT | ||
+ | < Server: Apache | ||
+ | < X-Powered-By: | ||
+ | < Set-Cookie: DokuWiki=s55csog34qnbk37tsn33b6and1; | ||
+ | < Expires: Thu, 19 Nov 1981 08:52:00 GMT | ||
+ | < Cache-Control: | ||
+ | < Pragma: no-cache | ||
+ | < Set-Cookie: DW68700bfd16c2027de7de74a5a8202a6f=deleted; | ||
+ | path=/; httponly | ||
+ | < Vary: Accept-Encoding, | ||
+ | < Transfer-Encoding: | ||
+ | < Content-Type: | ||
+ | < | ||
+ | { [data not shown] | ||
+ | 100 64546 0 64546 0 | ||
+ | host www.dokuwiki.tachtler.net left intact | ||
+ | |||
+ | * Closing connection #0 | ||
+ | </ | ||
+ | |||
+ | Nachfolgender Aufruf der Webseite [[http:// | ||
+ | < | ||
+ | # curl -v -o /dev/null --compressed http:// | ||
+ | </ | ||
+ | |||
+ | **__Ergebnis__**: | ||
+ | < | ||
+ | * About to connect() to www.dokuwiki.tachtler.net port 80 (#0) | ||
+ | * | ||
+ | * Connected to www.dokuwiki.tachtler.net (88.217.171.167) port 80 (#0) | ||
+ | > GET /doku.php HTTP/1.1 | ||
+ | > User-Agent: curl/7.19.7 (i386-redhat-linux-gnu) libcurl/ | ||
+ | libidn/1.18 libssh2/ | ||
+ | > Host: www.dokuwiki.tachtler.net | ||
+ | > Accept: */* | ||
+ | > Accept-Encoding: | ||
+ | > | ||
+ | % Total % Received % Xferd Average Speed | ||
+ | | ||
+ | 0 | ||
+ | < Date: Thu, 28 Mar 2013 15:20:37 GMT | ||
+ | < Server: Apache | ||
+ | < X-Powered-By: | ||
+ | < Set-Cookie: DokuWiki=f9degc9hajf4bub0071jeppmp5; | ||
+ | < Expires: Thu, 19 Nov 1981 08:52:00 GMT | ||
+ | < Cache-Control: | ||
+ | < Pragma: no-cache | ||
+ | < Set-Cookie: DW68700bfd16c2027de7de74a5a8202a6f=deleted; | ||
+ | path=/; httponly | ||
+ | < Vary: Accept-Encoding, | ||
+ | < Content-Encoding: | ||
+ | < Transfer-Encoding: | ||
+ | < Content-Type: | ||
+ | < | ||
+ | { [data not shown] | ||
+ | 100 9708 0 9708 0 | ||
+ | host www.dokuwiki.tachtler.net left intact | ||
+ | |||
+ | * Closing connection #0 | ||
+ | </ | ||
+ | |||
+ | :!: **HINWEIS** - **Die Komprimierung spart in oben gezeigtem Beispiel __75 %__ an Transfervolumen !!!** | ||
tachtler/apache_http_server_centos_7_-_mod_deflate_-_komprimierte_kommunikation.txt · Zuletzt geändert: 2016/12/05 14:26 von klaus