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 03-08-2008, 11:03 AM   #1
jpantone
LQ Newbie
 
Registered: Mar 2003
Location: Poway, CA (San Diego)
Distribution: Fedora Core 5
Posts: 19

Rep: Reputation: 0
Question Apache2 userdir "almost" works - can't serve images directory


This seems very strange to me.

I have successfully setup Apache2 (Ubuntu 7.10) and I can serve pages from

http://myserver.com/~myuser

and

http://myserver.com/~myuser/cgi-bin/cgipgm.cgi

but I cannot use an <img src="... in the html files in /home/myuser/public_html/images
it won't display the image.

Oddly, I can point the browser to http://myserver.com/~myuser/images/someimage.gif
and it will display the image.

I have no .htaccess in /home/myuser/public_html/images

Anyone got a suggestion?

Thanks
 
Old 03-09-2008, 04:53 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
what error do you get? 404? what is the code you're using? what does the access.log say about the request?
 
Old 03-09-2008, 10:12 AM   #3
jpantone
LQ Newbie
 
Registered: Mar 2003
Location: Poway, CA (San Diego)
Distribution: Fedora Core 5
Posts: 19

Original Poster
Rep: Reputation: 0
No error message, nor nothing in the log

It just displays the alt text

Here's my test code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>

</head>
<p>Hello! You have reached John Pantone's website.</p>
<p>Here is where I keep all matter of stuff, frome the silly
to the sublime</p>
<!-- this shows the alt text -->
<img src="http://johnpantone.homelinux.org:8080/~john/images/dialog-question.xpm" alt="images URL" />
<!-- this works just fine -->
<img src="http://johnpantone.homelinux.org:8080/images/otname.gif" alt="main/images"/">

<body>

</body>
</html>
 
Old 03-09-2008, 01:13 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
well start by cleaning up and using proper relative links - <img src="images/blah.png" /> - but those are xpm's... not valid images for webpages. stick to png, jpeg or gif.
 
Old 03-09-2008, 01:48 PM   #5
jpantone
LQ Newbie
 
Registered: Mar 2003
Location: Poway, CA (San Diego)
Distribution: Fedora Core 5
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks, but that's not the problem.

Changed index.html to:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>

</head>
<p>Hello! You have reached John Pantone's website.</p>
<p>Here is where I keep all matter of stuff, frome the silly
to the sublime</p>
<!-- this shows the alt text -->
<img src="/home/john/public_html/images/otname.gif" alt="images jmp" />
<!-- this works just fine -->
<img src="/var/www/images/otname.gif" alt="main/images"/">

<body>

</body>
</html>


and now neither image displays - no error, just the alt text.

if I point the browser to mysite.com/~john/images/otname.gif it will display it fine.

Wierd.
 
Old 03-09-2008, 03:09 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
I'm afraid to say that this is just your understanding of html.

within your code, the correct syntax in a file within /~john/ would be

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

that works just fine as i tested it myself through your exposed homepage.

your paths including /var and such are nonsensical. that information is for the remote client browser, not you, and (hopefully) youdomain.com/var/www/html...... doesn't exist, as that's what you're saying should be requested.
 
Old 03-09-2008, 05:07 PM   #7
jpantone
LQ Newbie
 
Registered: Mar 2003
Location: Poway, CA (San Diego)
Distribution: Fedora Core 5
Posts: 19

Original Poster
Rep: Reputation: 0
"I'm afraid to say that this is just your understanding of html."

You mean my lack of understanding!

Thank you so much. All is well now.
 
Old 07-15-2008, 11:57 AM   #8
oozypal
LQ Newbie
 
Registered: Nov 2007
Posts: 9

Rep: Reputation: 0
I have the same problem but with apache 1. How did you solve it?

Thank you
 
Old 07-15-2008, 12:09 PM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
Did you read the thread? it's just plain invalid HTML. It's a layer 8 problem here I'm afraid.
 
Old 07-15-2008, 12:59 PM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
if you don't have invalid code then you have a different problem, so this thread is totally unrelated to your question.
 
Old 07-15-2008, 01:05 PM   #11
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 256Reputation: 256Reputation: 256
Quote:
Originally Posted by oozypal View Post
I don't think so. Here is my code
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 6 November 2007), see www.w3.org" />

  <title></title>
</head>

<body>
  <h1>Data</h1><img src="images/imgad.gif" width="728" height="90"
  alt="ALT TEXT" />
</body>
</html>
100% valid code, isn't it?

What is weird is that if I change the directory to anything but the word "images", the code work ok and yes the image is in the "images" directory.
Does this html page reside in a directory that has the images/ directory? More details get better responses. What error do you get? Logs?
 
Old 07-15-2008, 01:20 PM   #12
oozypal
LQ Newbie
 
Registered: Nov 2007
Posts: 9

Rep: Reputation: 0
I get the "ALT TEXT".

Here is there error:

Code:
[Tue Jul 15 20:38:20 2008] [error] [client 192.168.1.3] File does not exist: /usr/share/images/imgad.gif
I don't understand why apache is looking for the image in

Code:
/usr/share/images
 
Old 07-15-2008, 01:23 PM   #13
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 256Reputation: 256Reputation: 256
Quote:
Originally Posted by oozypal View Post
I get the "ALT TEXT".

Here is there error:

Code:
[Tue Jul 15 20:38:20 2008] [error] [client 192.168.1.3] File does not exist: /usr/share/images/imgad.gif
I don't understand why apache is looking for the image in

Code:
/usr/share/images
Where's your document root configured? What happens if you put the full URL to the image in your html?
 
Old 07-15-2008, 01:24 PM   #14
oozypal
LQ Newbie
 
Registered: Nov 2007
Posts: 9

Rep: Reputation: 0
Ok figured it out. I commented

Code:
#Alias /images/ /usr/share/images/
in the http.conf

Code:
<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>
Problem solved and I hope there is no side effect to this action.
 
Old 07-15-2008, 01:25 PM   #15
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 256Reputation: 256Reputation: 256
There you go! Logs are priceless
 
  


Reply

Tags
apache2, images, userdir


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
"Minicom -s" works, but it always show "Offline", then cannot communicate with others reflecter_chen Linux - Hardware 8 05-14-2016 02:05 PM
"directory holding images" /dev/hda1 galois007 Linux - Newbie 4 01-18-2006 05:06 AM
Adding a footer to "directory style" apache2 output {Rm}Gh0sT Linux - Software 2 01-16-2006 02:51 AM
Xlib: connection to ":0.0" refused by serve alaios Linux - Software 7 05-19-2005 09:39 AM
Exception in thread "main" java.lang.InternalError: Can't connect to X11 window serve paragvd Programming 4 10-05-2004 03:35 AM

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

All times are GMT -5. The time now is 07:58 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration