Apache help needed please

Hello, I hope someone can help me with this query please; I think it’s quite complicated to explain so bear with me!

I have an apache webserver running on Suse11.0 at http://badgerfruit.homeip.net; one of the links (“Media List”) provides the user with a list of files within specific folders. Let’s call this PC1

I want to get the music list to provide a JPEG “cover art” preview but I’m having big trouble!

The files themselves are stored on another PC (for reference, call this PC2), also running Suse11.0 and they are mounted using fstab.

Although it mounts OK and I can get a directory listing from it no problem, I just can not get any images!

The fstab on PC1 reads:
//192.168.1.224/music /srv/www/htdocs/music cifs username=badger_fruit,password=**********,auto,uid=root,gid=www,_netdev 0 0

if you point your web-browser to badgerfruit.homeip.net and select Music then hit Submit you will see what I mean.

The particular image it is trying to load is “http://badgerfruit.homeip.net/music/1200%20Mics%20-%20The%20Time%20Machine/209.jpg

When I put that into my browser, instead of a picture, I just get the text of the URL (I suspect in Firefox this means “not found”). The picture exists as to get the path, I have done a search for all JPG images and create the URL.

I am pretty certain it’s “USER ERROR” haha but what and where, well, I don’t know!!

I am totally open to suggestions for things to try, all help is appreciated!

Hi,

The path is wrong in your HTML:


<img src=/music/1200 Mics - The Time Machine/209.jpg>

should be


<img src="music/1200 Mics - The Time Machine/209.jpg" >

Starting the path with / means that the machine begins to search at the root dir and not in the /srv/www/htdocs dir. Also you should add the " to write good HTML.

hth

Bye

Erik

thank you for the prompt reply although i don’t think that’s the solution. the leading / in the HTML means from the root of the website, which in this case, is correct.

The server root is at /srv/www/htdocs and there is a sub-folder (/srv/www/htdocs/music) where the share is mounted.

An ls of the folder /srv/www/htdocs/music returns the listing as expected.

I know this is the case because I call my images used on the website using <img src=’/imagefolder/image.jpg’> and they are displayed. By all accounts, referencing <img src=’/music/folder/image.jpg’> should show it.

What I do find strange is that the web-page returns the listing of the folder but will not show any images from it!

Which leads me to think it’s a permission thing - HOWEVER, I also don’t think it is, because surely it wouldn’t give me a directory listing.

As it is a physical folder from the root of the webserver, I don’t think I need to add anything into an apache config file (in /etc/apache2/conf.d) but I might be wrong.

Interestingly enough, I added the code below into apache config the directory and although I get a directory listing and can browse into the 1200 Mics folder, I still can’t view the image in a browser!

<Directory “/srv/www/htdocs/music”>
Options Indexes
Order allow,deny
Allow from all
</Directory>

try it at Index of /music
wierd huh?

Hello Badgerfruit,

I do not quite understand your problem, but using Konqueror when I go to http://badgerfruit.homeip.net/music/ I get a dir list. Then I click on http://badgerfruit.homeip.net/music/1200 Mics - The Time Machine/209.jpg and get a dirlist again. Then I click on http://badgerfruit.homeip.net/music/1200 Mics - The Time Machine/209.jpg I get a no complaint, but just a gray window with the right address in the address bar. The image size is 0x0. When I try to save the image to disk I get an error “Connection to host badgerfruit… broken”. But I can click the reload button without any problem.

I FF indeed the complte URL is also in the wiindow.

Something is going on. I know you can config Apache to not sending certain types of files, but I think that is not the default.

Hi,

Well, I do web programing for about 15 years now and learned that the leading / is wrong. :wink: It works for you so it’s ok.

It could be a permission fault. I tried to download the pic with my browser without any result. So it could be that the executable bit is set. The web server would try to execute the jpg without any result.

hth

Bye

Erik

hello guys thanks again for the help …
yes, it is very strange (i’ve turned it off now as it was giving me a headache lol!) but i copied an existing directive from my .conf file (Index of /public) and that shows images just fine.

I also checked the permissions, mounting it using wwwrun and www group instead of root/root. the file did not have X bit set either.

I have reverted it back as moving the mount seemed to break other things on the portal such as the search feature :frowning:

so, it’s back to the drawing board but it’s getting late here in the UK and i’ve got to be at work early tomorrow (booo).

Oh and erikro i too have done web for many years … the use of / is all relative

if you’re on www.foobar.com/badger/index.html and your images are at www.foobar.com/images, in index.html you would use <img src=’/images/myimage.jpg’>. If you were at www.foobar.com/index.html, you could get away with <img src=‘images/myimage.jpg’>.

Even when i am in www.foobar.com/index.html, i like to make sure the correct place is referenced, hence the leading /.

it would be interesting to hear your reason why it’s wrong though :slight_smile: just as a discussion :slight_smile:

Using a leading / is fine.

You can read the complete rules in the standard document at World Wide Web Consortium - Web Standards, but it suffices to think of the web client as filling in the missing bits.

If only a relative path is used, e.g. image.jpg, then it is prefixed with the scheme, the host and the current path, e.g. http://www.example.org/some/directory/image.jpg

If an absolute path is used, e.g. /someother/directory/image.jpg, then it is prefixed with the scheme and the host, e.g. http://www.example.org/someother/directory/image.jpg.

Using relative paths gives freedom to move the page and its associated links elsewhere as a unit.

Using absolute paths gives freedom to move the whole website to another host as a unit.

Thanks for that Ken.

Alright, back to the OP …
In response to myself regarding copying an existing directive from the .conf file, this worked because the resource used in this directive was a LOCAL folder, actually within the root folder of the website. it purely says to apache to allow a directory listing.

I changed the location to one that is on a remote-share and lo and behold, the images do not show and when I right-click > save as … I get a 0kb file.

I am going to try pointing the link to a local (to the webserver) folder but one which is outside of the www root folder … wish me luck :wink:

EDIT > Just tested it and it works, I see images and when I R/Click > Save as … I get the full file as expected. it must be something to do with the remote-share mounting

lol, nice website badger, although I would be too scared to advertise that I had all that stuff myself :|.

ha yeah, well it’s all for erm … thoretical research. Yes, that’s it :wink:

You will be pleased to know (well, I am anyway!) that this is now sorted. I had to install Apache onto PC2 and use ProxyPass on PC1. It’s slow and clunky though but it works so hoorah for me :slight_smile: