Just upgraded an old box to Ubuntu 10.04.2 LTS. Apache will not display images to a browser that are over about 2K. Small images seem to display fine. Static HTML and PHP continues to works fine as well.
apache2 2.2.14-5ubuntu8.4 apache2-mpm-prefork 2.2.14-5ubuntu8.4 apache2-utils 2.2.14-5ubuntu8.4 apache2.2-bin 2.2.14-5ubuntu8.4 apache2.2-common 2.2.14-5ubuntu8.4
here is an ngrep of an image that doesn't display fine in the browser:
T 192.168.0.4:32907 -> 192.168.0.54:80 [AP] GET /path/path/logo.png HTTP/1.1..Host: 192.1 68.0.54..Connection: keep-alive..Accept: application/xml,application/xhtml+ xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5..User-Ag ent: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.98 Safari/534.13..Accept-Enco ding: gzip,deflate,sdch..Accept-Language: en-US,en;q=0.8..Accept- Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3.... T 192.168.0.54:80 -> 192.168.0.4:32907 [A] HTTP/1.1 200 OK..Date: Wed, 09 Mar 2011 05:28:38 GMT..Server: Apa che/2.2.14 (Ubuntu)..Last-Modified: Tue, 05 Oct 2010 11:59:17 GMT ..ETag: "17b6f4-15fe-491dd63eb2f40"..Accept-Ranges: bytes..Conten t-Length: 5630..Keep-Alive: timeout=15, max=100..Connection: Keep -Alive..Content-Type: image/png.....PNG........IHDR...!...v...... .%.....sRGB.........bKGD..............pHYs.................tIME.. etc...
This looks ok to me!
I have tried firefox and chrome, both display small images fine but when a large image is requested the browser prompts to download the file.
When the image file is saved to the local computer it is corrupt, it also takes a long time to save which makes me think the browser cannot see the content-length header sent from apache. Also when I look at the saved image file it includes the headers from apache, along with a bit of garbage at the top, like so:
vi logo.png: ^@^UÅd^@$^]V^S^H^@E^@^Q,n!@^@@^F^@^@À¨^@6À¨^@^D^@P^Y¬rÇÅ¹éw^P^@Ú^@^@^A^A^H ^@^GÝ^]^@pbSHTTP/1.1 200 OK^M Date: Wed, 09 Mar 2011 04:47:04 GMT^M Server: Apache/2.2.14 (Ubuntu)^M Last-Modified: Tue, 05 Oct 2010 11:59:17 GMT^M ETag: "17b6ff-157c-491dd63eb2f40"^M Accept-Ranges: bytes^M Content-Length: 5500^M Keep-Alive: timeout=15, max=94^M Connection: Keep-Alive^M Content-Type: image/png^M ^M PNG^M etc...
Any ideas? It's driving me nuts.
There is nothing in apache error logs, and permissions are fine (because the image data is there, it's just somewhat corrupt).
There's no proxy or iptables on this ubuntu box either.
ps: just tried on IE from a different computer, same problem :( pps: rebooted server, no help.
Thanks for those wget ideas:
here's the output of wget from a remote machine (it couldn't read headers)
dbaker@fatburt:~$ wget http://foo/static/images2/nav_sprite.jpg --2011-03-10 17:41:06-- http://foo/static/images2/nav_sprite.jpg Resolving foo... 192.168.0.54 Connecting to foo|192.168.0.54|:80... connected. HTTP request sent, awaiting response... 200 No headers, assuming HTTP/0.9 Length: unspecified Saving to: `nav_sprite.jpg'
here's output of wget from the local server back onto itself (works fine)
wget http://foo/static/images2/nav_sprite.jpg --2011-03-10 17:44:51-- http://foo/static/images2/nav_sprite.jpg Resolving foo... 192.168.0.54 Connecting to foo|192.168.0.54|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 79192 (77K) [image/jpeg] Saving to: `nav_sprite.jpg'
thanks @uesp adding "EnableMMAP off" to /etc/apache2/httpd.conf and restarting apache fixed it, no idea why, but it did.