PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : mod_gzip und komprimieren von pdf u. ps?



nobody0
22.04.02, 19:48
Der Apache auf meinem Server komprimiert keine pdf- u. ps-Dateien, obwoh inch in der httpd.conf vom Apache folgendes habe:

bandwidthpulse 200000
BandWidthPulse 200000
bandwidth all 8952
Bandwidth all 8952
largefilelimit 1 8952
LargeFileLimit 1 8952
minbandwidth all 1492
MinBandWidth all 1492
# BandWidthDataDir /tmp/apachebw
BandwidthModule On

mod_gzip_temp_dir /tmp/apache/gzip
mod_gzip_on Yes
# although the minimum seems to be 300 with values < 300:
mod_gzip_minimum_file_size 254
mod_gzip_maximum_file_size 500000000
mod_gzip_maximum_inmem_size 500000000
mod_gzip_keep_workfiles No
mod_gzip_item_include file \.htm
mod_gzip_item_include file \.html
mod_gzip_item_include file \.ps
mod_gzip_item_include file \.eps
mod_gzip_item_include file \.pdf
mod_gzip_item_include file \.jsp$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-httpd-php
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_item_include handler ^perl-script$
mod_gzip_item_include handler ^server-status$
mod_gzip_item_include handler ^server-info$
mod_gzip_item_include mime text/.*
mod_gzip_item_include mime "jserv-servlet"
mod_gzip_item_include handler "jserv-servlet"
mod_gzip_item_include mime "application/x-httpd-php.*"
mod_gzip_item_include mime httpd/unix-directory
# mod_gzip_item_exclude file \.css$
# mod_gzip_item_exclude file \.js$
# mod_gzip_item_exclude mime ^image/.*
# mod_gzip_item_exclude file "\.wml$"
# mod_gzip_item_exclude reqheader "User-Agent: Mozilla/4\.[0-9][0-9].*"
# mod_gzip_item_exclude reqheader "User-Agent: Mozilla/4\.[4-9][^0-9].*"
mod_gzip_dechunk yes
mod_gzip_add_header_count Yes
LogFormat "%h %l %u %t \"%V %r\" %>s %b mod_gzip: %{mod_gzip_result}n In:%{mod_gzip_input_size}n Out:%{mod_gzip_output_size}n:%{mod_gzip_compressio n_ratio}npct." common_with_mod_gzip_info2
CustomLog /var/log/httpd/mod_gzip common_with_mod_gzip_info2


Wie bekomme ich es trotzdem hin, dass auch pdf- u. .ps-Dateien komprimiert werden? :confused:

Olli
22.04.02, 20:01
> Der Apache auf meinem Server komprimiert keine pdf- u. ps-Dateien, obwoh inch >in der httpd.conf vom Apache folgendes habe:

Hast Du schon mal im /var/log/httpd/mod_gzip reingeschaut. Oft schreibt mod_gzip dort rein, warum er es nicht komprimierte. Bei pdf-Dateien hilft eine Komprimierung zB. oft nicht mehr, da das gezippte File oft größer ist als das Original.
Poste doch einfach al einen Ausschnitt einer betroffenen Datei...
oliver

nobody0
23.04.02, 15:44
Hier sind mal ein paar Zeilen:

192.168.59.7 - - [22/Apr/2002:19:06:08 +0200] "gin.random.linux-site.net GET /files/unsorted/gas/kn2.pdf HTTP/1.0" 200 69683 mod_gzip: DECLINED:EXCLUDED In:0 Out:0:0pct.
192.168.59.7 - - [22/Apr/2002:19:11:50 +0200] "gin.random.linux-site.net GET /files/unsorted/gas/kn2.pdf HTTP/1.0" 304 - mod_gzip: DECLINED:EXCLUDED In:0 Out:0:0pct.
192.168.59.7 - - [22/Apr/2002:19:17:36 +0200] "gin.random.linux-site.net GET /files/unsorted/gas/kn2.pdf HTTP/1.0" 304 - mod_gzip: DECLINED:EXCLUDED In:0 Out:0:0pct.
192.168.59.7 - - [22/Apr/2002:19:17:41 +0200] "gin.random.linux-site.net GET /files/unsorted/gas/kn2.pdf HTTP/1.0" 304 - mod_gzip: DECLINED:EXCLUDED In:0 Out:0:0pct.
192.168.59.7 - - [22/Apr/2002:19:17:53 +0200] "gin.random.linux-site.net GET / HTTP/1.0" 200 746 mod_gzip: OK In:662 Out:332:50pct.
192.168.59.7 - - [22/Apr/2002:19:17:54 +0200] "gin.random.linux-site.net GET /top_frame.htm HTTP/1.0" 200 752 mod_gzip: OK In:657 Out:337:49pct.
192.168.59.7 - - [22/Apr/2002:19:17:54 +0200] "gin.random.linux-site.net GET /Bilder/eversion.gif HTTP/1.0" 200 1230 mod_gzip: DECLINED:EXCLUDED In:0 Out:0:0pct.
192.168.59.7 - - [22/Apr/2002:19:17:55 +0200] "gin.random.linux-site.net GET /navi_frame.htm HTTP/1.0" 200 1045 mod_gzip: OK In:3870 Out:630:84pct.

Ragnarok
24.04.02, 15:14
deine config ist nciht gerade sinnvoll ;))
bis dein webserver 500 MB gezippt hat und du dabei vielleicht 10% platz gespart hast, hat er das file dreimal weggeschickt ;))

im log steht, dass pdf DECLINED ist.
also stimmt was mit der config nicht!

Olli
24.04.02, 15:59
HTTP-Code 304:
If the client has done a conditional GET and access is allowed, but the document has not been modified since the date and time specified in If-Modified-Since field, the server responds with a 304 status code and does not send the document body to the client.

Das ist zumindest die Begründung, warum mod_gzip das Dokument nicht gezipped hat. Es wurde überhaupt nicht mehr gesendet, da es z.B. noch im Cache des Browsers/Proxy war.

oliver

nobody0
24.04.02, 20:21
Also nach einem reboot (weil DSL einen hangup hatte, also nach zwangstrennung u. mit neuer ip nichts über DSL funktionierte) ist die Meldung nun:

192.168.59.7 - - [24/Apr/2002:20:12:24 +0200] "gin.random.linux-site.net GET /files/unsorted/gas/kn2.pdf HTTP/1.0" 200 70083 mod_gzip: SEND_AS_IS:RESPONSE_CONTENT_TYPE_EXCLUDED In:0 Out:0:0pct.

Der Vollständigkeit halber ist meine Konfig (die vom Apache korrekt gezipt wird) hier:

http://random.linux-site.net/files/unsorted/httpd.conf

Für konkrete Verbesserungsvorschläge (für meinen DSL-Router, bei dem der Apache maximal die halbe Bandbreite belegen darf) bin ich dankbar. :rolleyes:


Übrigens habe ich es mal getestet: die betreffende PDF-Datei ist gezipt nicht einmal halb so gross und bei PS (Postscript) ist es genau so.
Bei PDF u. PS soll deshalb immer gezipt werden.

Olli
24.04.02, 22:09
Hallo nobody0,
ich habe mal mit deinen mod_gzip-Eistellungen experimentiert. Versuche mal ein $-Zeichen an die Dateitypen anzuhängen:
mod_gzip_item_include file \.ps$
mod_gzip_item_include file \.eps$
mod_gzip_item_include file \.pdf$

Bei mir hat es das geklappt!

Oliver

nobody0
25.04.02, 23:58
Das hat nicht funktioniert:

192.168.59.7 - - [25/Apr/2002:23:56:40 +0200] "gin.random.linux-site.net GET /files/unsorted/gas/kn2.pdf HTTP/1.1" 200 70027 mod_gzip: SEND_AS_IS:RESPONSE_CONTENT_TYPE_EXCLUDED In:0 Out:0:0pct.

Kannst Du mal die ganze Config posten oder zum Download bereitstellen? :confused:

Olli
26.04.02, 07:39
Morgem
das einzige, was noch andere ist, sind die Zeilen 5, 6 und 13:

mod_gzip_temp_dir /tmp/apache/gzip
mod_gzip_on Yes
# although the minimum seems to be 300 with values < 300:
mod_gzip_minimum_file_size 254
#mod_gzip_maximum_file_size 500000000
#mod_gzip_maximum_inmem_size 500000000
mod_gzip_keep_workfiles No
mod_gzip_item_include file \.htm
mod_gzip_item_include file \.html
mod_gzip_item_include file \.ps$
mod_gzip_item_include file \.eps$
mod_gzip_item_include file \.pdf$
mod_gzip_item_include file \.jsp$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime "application/pdf"
mod_gzip_item_include mime ^application/x-httpd-php
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_item_include handler ^perl-script$
mod_gzip_item_include handler ^server-status$
mod_gzip_item_include handler ^server-info$
mod_gzip_item_include mime text/.*
mod_gzip_item_include mime "jserv-servlet"
mod_gzip_item_include handler "jserv-servlet"
mod_gzip_item_include mime "application/x-httpd-php.*"
mod_gzip_item_include mime httpd/unix-directory
# mod_gzip_item_exclude file \.css$
# mod_gzip_item_exclude file \.js$
# mod_gzip_item_exclude mime ^image/.*
# mod_gzip_item_exclude file "\.wml$"
# mod_gzip_item_exclude reqheader "User-Agent: Mozilla/4\.[0-9][0-9].*"
# mod_gzip_item_exclude reqheader "User-Agent: Mozilla/4\.[4-9][^0-9].*"
mod_gzip_dechunk yes
mod_gzip_add_header_count Yes

LogFormat "%h %l %u %t \"%V %r\" %>s %b mod_gzip: %{mod_gzip_result}n In:%{mod_gzip_input_size}n Out:%{mod_gzip_output_size}n:%{mod_gzip_compressio n_ratio}npct." common_with_mod_gzip_info2
CustomLog /var/log/httpd/mod_gzip common_with_mod_gzip_info2


oliver

nobody0
26.04.02, 10:35
Aha, danke.

Also das hat merkwürdigerweise an den Limits gelegen; das mit application allein reichte nicht. Eigentlich sollte das unabhängig sein, ist es aber nicht.