LinuxQuestions.org
Visit Jeremy's Blog.
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 01-24-2009, 05:15 PM   #1
fakeer
LQ Newbie
 
Registered: Jan 2009
Posts: 7

Rep: Reputation: 0
Images not served by apache over a symbolic link folder


a variation of the problem i'm facing has be mentioned before here (however without resolution):

http://www.linuxquestions.org/questi...ic+link+images

my setup involves a Centos 5 server and a Windows XP box with images

1. i mount the windows images directory e:\Pics on under /mnt/pics

2. on centos a vhost (www.mysite.org) is setup with the root as /var/www/web3/web

3. i created a symbolic link as
Code:
ln -s /mnt/pics /var/www/web3/web/Pics
4. in the vhost configuration the apache directives are setup to follow symbolic links
Code:
<Directory /var/www/web3/web>
    Options Indexes FollowSymLinks
 </Directory>
at this point if i go to
Code:
http://www.mysite.org/Pics
i can see the listing just fine and can see the directory of JPG and GIF files. however when i click on one i just get a broken image. the http response also seems fine and is 200.

there are no permission issues because on the windows share i can access html and txt files just fine. for e.g.
Code:
http://www.mysite.org/Pics/letter.txt
the problem is with serving the images like
Code:
http://www.mysite.org/Pics/foo.gif
. it might also be a problem with other times of media files but i haven't tried.

does this look like a mime issue to anyone? or is it just the way the mount was done. the question is why would it serve up non-images fine but fail while returning images..

Last edited by fakeer; 01-24-2009 at 05:18 PM. Reason: clarity
 
Old 01-25-2009, 01:16 AM   #2
fakeer
LQ Newbie
 
Registered: Jan 2009
Posts: 7

Original Poster
Rep: Reputation: 0
The Solution

with a bit more creative use of keywords i was able to reach this post (surprise, it was again back on linuxquestions.org)

https://www.linuxquestions.org/quest...mlinks-443537/

the problem is with serving all binary files of which i had gotten just a taste with the images not working. the fix therefore was to turn off apache's memory-mapping of files. in the systems that supports this it could form a rather efficient cache by itself. my system won't be serving massive amounts of content but any large scale system should investigate this setting more closely.

in /etc/httpd/conf/httpd.conf find the relevant sections as below and uncomment the lines:
Code:
#
# EnableMMAP: Control whether memory-mapping is used to deliver
# files (assuming that the underlying OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems.  On some systems, turning it off (regardless of
# filesystem) can improve performance; for details, please see
# http://httpd.apache.org/docs/2.2/mod/core.html#enablemmap
#
EnableMMAP off

#
# EnableSendfile: Control whether the sendfile kernel support is
# used to deliver files (assuming that the OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems.  Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile
#
EnableSendfile off
then a bounce
Code:
service httpd restart

to know more about why it does what it does you can look at the docs for these obscure attributes at http://httpd.apache.org/docs/2.2/mod...tml#enablemmap

Quote:
This directive controls whether the httpd may use memory-mapping if it needs to read the contents of a file during delivery. By default, when the handling of a request requires access to the data within a file -- for example, when delivering a server-parsed file using mod_include -- Apache memory-maps the file if the OS supports it.

This memory-mapping sometimes yields a performance improvement. But in some environments, it is better to disable the memory-mapping to prevent operational problems:

* On some multiprocessor systems, memory-mapping can reduce the performance of the httpd.
* With an NFS-mounted DocumentRoot, the httpd may crash due to a segmentation fault if a file is deleted or truncated while the httpd has it memory-mapped.

and there went my entire day . . .
 
  


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
Can I recover from creating a symbolic link with the same name as an existing folder? serutan Linux - Newbie 3 10-07-2007 04:20 AM
apache config, how can I only allow people to view images in a folder? exodist Linux - Software 2 08-06-2006 05:33 PM
apache: using symbolic link to cgi-bin executable: how-to minutes2memories Linux - Software 4 03-02-2006 02:05 AM
apache new folder link zeky Linux - General 6 09-01-2002 07:34 PM
png images not served by apache ..??? gene_gEnie Linux - Software 2 05-10-2002 08:11 AM

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

All times are GMT -5. The time now is 05:33 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
Open Source Consulting | Domain Registration