LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 02-08-2005, 02:15 PM   #1
Erik Thorsson
Member
 
Registered: Jun 2004
Location: NYC
Distribution: Fedora Core 1
Posts: 64

Rep: Reputation: 15
Apache doesn't load images when using vhosts...


This is the weirdest thing. I have a couple Virtual Hosts running on my machine. When I access their directories by http://myipaddress/directory/ they display just fine.

But when I try and connect with the virtual host, the HTML renders fine, but no images are displayed! http://myvirtualhost.com

No images? WTF?

Directory structure of the vhost is like this:

index.html
images/

All the pictures are stored in "images/". It's like it refuses to look any farther up into the directory structure than the first directory of the vhost.

What is going on??? I'm pulling my hair out here.

-Erik!
 
Old 02-08-2005, 02:19 PM   #2
sigsegv
Senior Member
 
Registered: Nov 2004
Location: Third rock from the Sun
Distribution: NetBSD-2, FreeBSD-5.4, OpenBSD-3.[67], RHEL[34], OSX 10.4.1
Posts: 1,197

Rep: Reputation: 47
This smells like "not an Apache problem"

What do your image links look like? Are they "images/imagename.xxx", "/images/imagename.xxx" or "directory/images/imagename.xxx" ? The first 2 will work but the last one will not (obviously). Example: If you right click on where the image should be and click "View Image", where are you taken?

I can't think of anything off the top of my head that you could do with either server config or permissions which would do this (well, not accidentally anyway).


Last edited by sigsegv; 02-08-2005 at 02:21 PM.
 
Old 02-08-2005, 02:24 PM   #3
Erik Thorsson
Member
 
Registered: Jun 2004
Location: NYC
Distribution: Fedora Core 1
Posts: 64

Original Poster
Rep: Reputation: 15
Thanks for the reply. Image tags are all like this...

<img src="images/stereo.gif" alt="NEWS">

and so, should work.

In IE, if I right-click on the broken image icon and do Properties it gives me a correct URL to where the image should be...

http://mydomainname.com/images/stereo.gif

If I try to View Image in Firefox it takes me to the correct URL also, but says it cannot be found.

I have indexes enabled on my server and can't even get an index of http://mydomainname.com/images/

The images/ dir is: drwxr-xr-x

The images in the images/ dir are all: -rw-rw-r--

I even tried root@host:/var/www/directory/images# chmod a+x * so that all the images were -rwxrwxr-x, but that didn't work either.

BTW, this is apache 1.3.33 on a Debian Sarge install, kernel 2.6.8. Should I send the httpd.conf?

-E

Last edited by Erik Thorsson; 02-08-2005 at 02:35 PM.
 
Old 02-08-2005, 02:40 PM   #4
sigsegv
Senior Member
 
Registered: Nov 2004
Location: Third rock from the Sun
Distribution: NetBSD-2, FreeBSD-5.4, OpenBSD-3.[67], RHEL[34], OSX 10.4.1
Posts: 1,197

Rep: Reputation: 47
Are you mixing case? *NIX filesystems are case sensitive

You can post your httpd.conf if you like, but if you do, please post the output of grep -v '^#' httpd.conf which will remove all the comment lines.

Also, check the error log for the vhost(s) in question. Apache will log the file path that it tried to serve as well as the error code you're getting (404 is not found, 403 is forbidden, etc). Unless you have a pretty compelling reason not to, a URL to see the behavior would be helpful too (though if it's an internal or work related thing I completely understand not divulging that info).
 
Old 02-08-2005, 03:01 PM   #5
Erik Thorsson
Member
 
Registered: Jun 2004
Location: NYC
Distribution: Fedora Core 1
Posts: 64

Original Poster
Rep: Reputation: 15
Yeah, I know UNIX filesystems are case sensitive.

Ah-ha! WTF. Here's the error log output...

oak:/etc/apache/logs# tail -f mydomainname.com-error_log
[Tue Feb 8 15:57:21 2005] [error] [client x] File does not exist: /usr/share/images/ltologo178.jpg
[Tue Feb 8 15:57:21 2005] [error] [client x] File does not exist: /usr/share/images/anadelay.gif
[Tue Feb 8 15:57:21 2005] [error] [client x] File does not exist: /usr/share/images/ltoblur.gif
[Tue Feb 8 15:57:29 2005] [error] [client x] File does not exist: /usr/share/images/ltologo178.jpg

Why is it referencing a link like...

<img src="images/booya.gif">

...off /usr/share/ instead of off the directory that is making the reference???

I'd rather not provide the real URLs for security reasons, you understand. I think we're definitely getting close now. Shouldn't be necessary.
 
Old 02-08-2005, 03:12 PM   #6
sigsegv
Senior Member
 
Registered: Nov 2004
Location: Third rock from the Sun
Distribution: NetBSD-2, FreeBSD-5.4, OpenBSD-3.[67], RHEL[34], OSX 10.4.1
Posts: 1,197

Rep: Reputation: 47
What's the DocumentRoot set to for the vhosts? It should be /path/to/your/docroot , but it looks like it's either set to /usr/local or not at all and being overriden from somewhere else. Do you have any RewriteRule or Alias(Match) directives in your httpd.conf?

Posting your conf might be in order if you can't figure it out.

Security reasons? This is a public site that you're making, right? If it's not secure, I'd not put it up

Last edited by sigsegv; 02-08-2005 at 03:14 PM.
 
Old 02-08-2005, 07:38 PM   #7
Draygo
Member
 
Registered: May 2004
Location: Frisco, TX
Distribution: Debian Unstable
Posts: 73

Rep: Reputation: 15
Debian by default has this alias setup in the httpd.conf

<IfModule mod_alias.c>
Alias /icons/ /usr/share/apache/icons/

<Directory /usr/share/apache/icons>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Alias /images/ /usr/share/images/

<Directory /usr/share/images>
Options MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</IfModule>

All you need to do is comment out the Alias for /images/
 
Old 02-09-2005, 07:23 AM   #8
Erik Thorsson
Member
 
Registered: Jun 2004
Location: NYC
Distribution: Fedora Core 1
Posts: 64

Original Poster
Rep: Reputation: 15
Thanks much, everyone. That was the problem alright.

Fixed.

Score one for linuxquestions.org.

-E
 
  


Reply



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 with Vhosts in apache please. GEEF Linux - Software 2 10-29-2004 07:18 PM
apache + dns + vhosts albertos Slackware 1 08-03-2003 07:03 PM
apache 2.0.44 vhosts sqn Slackware 4 06-19-2003 12:54 AM
apache vhosts question sqn Linux - Networking 0 04-01-2003 04:27 PM
Vhosts on RH 8.0 - Apache 2.0.40 Drogo Linux - Software 5 02-06-2003 11:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 08:06 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