LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache won't server picture files if under aliased directory (https://www.linuxquestions.org/questions/linux-server-73/apache-wont-server-picture-files-if-under-aliased-directory-611516/)

Sheridan 01-06-2008 10:33 AM

Apache won't server picture files if under aliased directory
 
Dear All,

I have a pressing problem.

Just migrated a bunch of webpages onto a new server (old server was not my doing).

There're lots of pages served as virtual hosts like this:

Code:

<VirtualHost *:80>
    UseCanonicalName    Off

    RewriteEngine on
    RewriteCond  %{REQUEST_FILENAME}      ^/(.*)cmd.exe(.*)      [OR]
    RewriteCond  %{REQUEST_FILENAME}      ^/(.*)root.exe(.*)
    RewriteRule  ^(.*)                    https://www.microsoft.com$1    [L,R]

    RewriteCond /export/www/root/%{HTTP_HOST}      !-d
    RewriteCond /export/www/root/%{HTTP_HOST}      !-f
    RewriteRule ^(.*)                    http://www.myhomepage.com/    [L,R]

    VirtualDocumentRoot /export/www/root/%0
    VirtualScriptAlias /export/www/root/%0/cgi-bin/
</VirtualHost>

Also, I have many aliases, like this:

Code:

Alias /ettcsa/ "/export/www/pildid/ettcsa/"
Alias /atma/ "/export/www/pildid/atma/"

Now, if I point my browser to a picture file inside one of the virtual hosts, it will work just fine.

However, if I try to open a picture (of any extension, gif, jpg etc) which is under one of the aliased routes, like:

http://mysite.com/ettcsa/pic.gif

Then Apache first sends back a HTTP 200 answer, tells the client the type and size of the file, then as transfer would begin, it just closes the connection.

This is easiest to test by using wget. If I go ahead and do wget http://mysite.com/ettcsa/pic.gif, then wget will try about 20 times to get the file, every time complaining about zero sized answer, then eventually it gives up.

However, if I put another kind of file, for example, a .php file into that dir and I try opening it, I get the page correctly. Same happens if the exension is unknown to Apache, like ".asfasfasf", or the file has no extension at all... I just don't understand...

What is my problem, what do you think?

L.

Sheridan 01-07-2008 05:17 AM

Do you think it could be a problem that I serve the files from an AFS mounted distributed FS?

Sheridan 01-07-2008 10:11 AM

Quote:

Originally Posted by Sheridan (Post 3014174)
Do you think it could be a problem that I serve the files from an AFS mounted distributed FS?

It was EXACTLY the problem...

Turns out I had to turn off the following in httpd.conf, like if I were using an NFS mounted directory. AFS is like NFS in this regard.

Code:

EnableMMAP off
EnableSendfile off

Afther I did this, suddenly everything started working.

Maybe this will help another condemned soul.

Cheers!!!

Levente


All times are GMT -5. The time now is 04:17 PM.