This is a discussion on Strange behaviour with images & cgi-bin within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi all, I'm hoping someone can tell me what I'm doing wrong. I've a CGI script that ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi all,
I'm hoping someone can tell me what I'm doing wrong. I've a CGI script that outputs HTML, a part of which is a <IMG SRC="images/whatever.gif"> construct. The CGI page is outputting correctly, except that the images don't show up! What am I doing wrong?? Here's the relevant area from httpd.conf: -- <VirtualHost *:1003> ServerName srv1.local DocumentRoot /data/web/srv1/htdocs Alias manual /data/web/srv1/htdocs/manual Alias images /data/web/srv1/htdocs/images ScriptAlias /cgi-bin/ "/data/web/srv1/cgi-bin/" Alias /images/ "/data/web/srv1/htdocs/images/" </VirtualHost> -- Here's what's happening in error.log: -- [Wed Jun 25 12:09:15 2003] [error] [client 127.0.0.1] script not found or unable to stat: /data/web/srv1/cgi-bin/images [Wed Jun 25 12:09:15 2003] [error] [client 127.0.0.1] script not found or unable to stat: /data/web/srv1/cgi-bin/images [Wed Jun 25 12:09:15 2003] [error] [client 127.0.0.1] script not found or unable to stat: /data/web/srv1/cgi-bin/images [Wed Jun 25 12:09:15 2003] [error] [client 127.0.0.1] script not found or unable to stat: /data/web/srv1/cgi-bin/images [Wed Jun 25 12:09:15 2003] [error] [client 127.0.0.1] script not found or unable to stat: /data/web/srv1/cgi-bin/images [Wed Jun 25 12:09:15 2003] [error] [client 127.0.0.1] script not found or unable to stat: /data/web/srv1/cgi-bin/images -- It looks to me as though the images are being looked for in /data/web/srv1/cgi-bin/images, rather than where I specified (/data/web/srv1/htdocs/images). It also looks as though Apache is trying to treat the images as scripts (CGI, presumably). Is this purely because of where they're being looked for? If it helps, I'm using SuSE 8.1 and Apache 1.3.26 Many thanks, Garry |
|
|||
|
try setting the base href of your file - it this doesn't help you may
have to resort to specifying full path names in the cgi. <base href="http://my/server/page" /> prior to the <head> tag tells the server where the page is rooted, and then relative links will be based on this root. looks to me like the page is assuming doc root is in the cgi directory, and is trying to find images from there. telling it otherwise, or using absolute paths for your images (http://myserver/image/directory/image.gif), might fix this (if all else fails, drop a simlink in your cgi directory to the images dir, and enable follow simlinks for that dir...) -josh |
|
|||
|
Your config should be alright.
You can also add "/" to the tag <img src="/images/whatever.gif"> It's all about path. "Garry Short" <g4rry_short@zw4llet.com> wrote in message news:bdcepc$jis$1$8302bc10@news.demon.co.uk... > Joshua Nixon wrote: > > > try setting the base href of your file - it this doesn't help you may > > have to resort to specifying full path names in the cgi. > > > > <base href="http://my/server/page" /> prior to the <head> tag tells the > > server where the page is rooted, and then relative links will be based > > on this root. looks to me like the page is assuming doc root is in the > > cgi directory, and is trying to find images from there. telling it > > otherwise, or using absolute paths for your images > > (http://myserver/image/directory/image.gif), might fix this > > > > (if all else fails, drop a simlink in your cgi directory to the images > > dir, and enable follow simlinks for that dir...) > > > > -josh > > Josh, > > I have to admit I was very sceptical when I read this, since I was convinced > I needed to fix my httpd.conf setup. However, I've tried it and it works > perfectly! Thanks very much! > > That said, if anyone can tell me what's wrong with my configuration, I'm > still very interested in knowing. > > Thanks, > > Garry > > |
|
|||
|
Hi Garry,
I'm fairly new to apache but I had the same problem... the server was looking in htdocs as that is the server root.... you should try changing the <IMG SRC="images/whatever.gif"> to <IMG SRC="cgi-bin/images/whatever.gif"> We you trying to point to your images htdocs/images directory? Or your cgi-bin/images directory? Hope I've helped. Psychlone Garry Short wrote: > Hi all, > > I'm hoping someone can tell me what I'm doing wrong. I've a CGI script that > outputs HTML, a part of which is a <IMG SRC="images/whatever.gif"> > construct. > > The CGI page is outputting correctly, except that the images don't show up! > What am I doing wrong?? > > Here's the relevant area from httpd.conf: > -- > <VirtualHost *:1003> > ServerName srv1.local > DocumentRoot /data/web/srv1/htdocs > Alias manual /data/web/srv1/htdocs/manual > Alias images /data/web/srv1/htdocs/images > ScriptAlias /cgi-bin/ "/data/web/srv1/cgi-bin/" > Alias /images/ "/data/web/srv1/htdocs/images/" > </VirtualHost> > -- > Here's what's happening in error.log: > -- > [Wed Jun 25 12:09:15 2003] [error] [client 127.0.0.1] script not found or > unable to stat: /data/web/srv1/cgi-bin/images > [Wed Jun 25 12:09:15 2003] [error] [client 127.0.0.1] script not found or > unable to stat: /data/web/srv1/cgi-bin/images > [Wed Jun 25 12:09:15 2003] [error] [client 127.0.0.1] script not found or > unable to stat: /data/web/srv1/cgi-bin/images > [Wed Jun 25 12:09:15 2003] [error] [client 127.0.0.1] script not found or > unable to stat: /data/web/srv1/cgi-bin/images > [Wed Jun 25 12:09:15 2003] [error] [client 127.0.0.1] script not found or > unable to stat: /data/web/srv1/cgi-bin/images > [Wed Jun 25 12:09:15 2003] [error] [client 127.0.0.1] script not found or > unable to stat: /data/web/srv1/cgi-bin/images > -- > > It looks to me as though the images are being looked for in > /data/web/srv1/cgi-bin/images, rather than where I specified > (/data/web/srv1/htdocs/images). > > It also looks as though Apache is trying to treat the images as scripts > (CGI, presumably). Is this purely because of where they're being looked > for? > > If it helps, I'm using SuSE 8.1 and Apache 1.3.26 > > Many thanks, > > Garry > > |
| Thread Tools | |
| Display Modes | |
|
|