LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-14-2008, 10:51 AM   #1
sea-bass
LQ Newbie
 
Registered: Dec 2006
Posts: 14

Rep: Reputation: 0
Unable to view .jpg or jpeg in apache


Hi Guys,

I have anoying problem on a website whereby I cannot view .jpg or .jpegs in the browser... The Browser wants to download it to my desktop

I am using

Server version: Apache/2.0.52
Server built: May 24 2006 11:45:10


Now this is the confusing bit

I have added the line

#Added for mod_mime
LoadModule mime_module modules/mod_mime.so

Plus I have a section

# =================================================
# MIME encoding
# =================================================

<IfModule mod_mime.c>
TypesConfig conf/mime.types
</IfModule>
DefaultType text/plain
<IfModule mod_mime.c>
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-tar .tgz
AddType image/jpeg .jpg .jpeg
</IfModule>


Yet when I do a httpd -l

I get

Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
no mod_mime this may be a red herring...

What I am after is some pointers in getting this problem sorted.

Many Thanks

Sea-Bass
 
Old 02-14-2008, 02:31 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

1. You shouldn't usually have to worry about adding an "<IfModule mod_mime.c>" section.

2. Also: don't worry that "httpd -l" doesn't show mod_mime: it typically *won't* (because Apache should recognize MIME types automagically - *without* needing any separate module.

3. The first thing to check is if the behavior is specific to one browser, or happens on multiple different browsers.

4. The second thing is to check your global "mime.types" file.
Quote:
EXAMPLE:
less /usr/lib/mime.types
...
image/jpeg jpeg jpg jpe
<= For example, this is one of my systems...
This link use useful (you might recognize the name as the author of several great O'Reilly books):

http://www.ibm.com/developerworks/xm...tml/index.html

'Hope that helps .. PSM

PS:
For whatever it's worth, here's my configuration:
Quote:
1) /usr/sbin/httpd2-prefork -v =>
Server version: Apache/2.0.53

2) less /etc/apache2/mime.types =>
...
image/jpeg jpeg jpg jpe
image/png png
image/tiff tiff tif
...

3) less /etc/apache2/sysconfig.d/loadmodule.conf =>
...
LoadModule mime_module /usr/lib/apache2-prefork/mod_mime.so

4) /usr/sbin/httpd2-prefork -l =>
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c

Last edited by paulsm4; 02-14-2008 at 02:40 PM.
 
Old 02-14-2008, 05:09 PM   #3
aot2002
Member
 
Registered: Dec 2003
Location: NY
Distribution: Ubuntu 7.10
Posts: 66

Rep: Reputation: 15
Quote:
Originally Posted by sea-bass View Post
Hi Guys,

I have anoying problem on a website whereby I cannot view .jpg or .jpegs in the browser... The Browser wants to download it to my desktop

I am using

Server version: Apache/2.0.52
Server built: May 24 2006 11:45:10


Now this is the confusing bit

I have added the line

#Added for mod_mime
LoadModule mime_module modules/mod_mime.so

Plus I have a section

# =================================================
# MIME encoding
# =================================================

<IfModule mod_mime.c>
TypesConfig conf/mime.types
</IfModule>
DefaultType text/plain
<IfModule mod_mime.c>
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-tar .tgz
AddType image/jpeg .jpg .jpeg
</IfModule>


Yet when I do a httpd -l

I get

Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
no mod_mime this may be a red herring...

What I am after is some pointers in getting this problem sorted.

Many Thanks

Sea-Bass
FYI im not using mod_mime

httpd -l
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c

and ive got no issue's

Server version: Apache/2.2.6 (Unix)
Server built: Sep 7 2007 14:07:39
 
Old 02-15-2008, 04:17 AM   #4
sea-bass
LQ Newbie
 
Registered: Dec 2006
Posts: 14

Original Poster
Rep: Reputation: 0
Thumbs up Unable to view .jpg or .jpeg - Fix

Hi Folks,

Isn't that just the way...

Sat down at my desk and looked at a server and it works...

Thankfully I now what it was that fixed it as I have to replicate it across 3 other webservers...

I think the reason why it wasnt working yesterday was...

I did an httpd reload instead of httpd restart or stop and start and also forgetting to clear my cache might not have helped matters... forgive me it was one of those afternoons... :-)


The fix was as follows


1 - insert LoadModule mime_module modules/mod_mime.so
2 - added the following statement
<IfModule mod_mime.c>
TypesConfig conf/mime.types
</IfModule>
3 - /etc/init.d/httpd stop
4 - /etc/init.d/httpd start

Many Thanks to you all who came to my aid... Much appreciated..

Sea-Bass
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP! BASH - Convert filenames from dsc00***.jpg to *.jpg jimmybond01 Programming 9 05-08-2007 06:17 AM
Unable to view hda zorba11 Mandriva 2 08-04-2006 06:06 PM
Slow Apache (watch .jpg load) carlosinfl Linux - Software 1 07-29-2005 04:40 PM
Unable to burn jpeg files to a VCD using K3b camorri Linux - Software 2 08-19-2004 06:19 PM
unable to view documents from my apache server wendallsan Linux - Software 2 09-27-2003 03:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration