LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Image Directory Not Accessible on the Web (https://www.linuxquestions.org/questions/linux-newbie-8/image-directory-not-accessible-on-the-web-403547/)

kylee 01-15-2006 04:54 AM

Image Directory Not Accessible on the Web
 
Dear comrades,

I have copied the images directory from my home directory to the Apache web server Document Root /var/www.

I was not able to browse the content of the images directory via a browser http://192.168.0.11/images/linux_penguin.png. The error was 404 Not Found - The requested URL /images/linux_penguin.png was not found on this server.

However, if I copied the contents of /var/www/images directory to /var/www/images2 directory, I will not have this problem accessing http://192.168.0.11/images2/linux_penguin.png.

I am totally baffled. Please help.

Lee.


A directory listing is given here.

webserver:/var/www/images# ls -al
total 18
drwxr-xr-x 2 www-data www-data 1024 2006-01-15 18:10 .
drwxr-xr-x 6 root root 1024 2006-01-14 16:15 ..
-rw-r--r-- 1 www-data www-data 1144 2006-01-13 19:27 apache_logo.jpg
-rw-r--r-- 1 www-data www-data 151 2006-01-14 16:35 icon_pdf.gif
-rw-r--r-- 1 www-data www-data 2467 2006-01-13 19:27 linux_penguin.png
-rw-r--r-- 1 www-data www-data 2131 2006-01-13 19:27 mysql_logo.jpg
-rw-r--r-- 1 www-data www-data 2471 2006-01-13 19:27 OOo.jpg
-rw-r--r-- 1 www-data www-data 3172 2006-01-13 19:27 php_logo_large.png


webserver:/var/www/images2# ls -al
total 18
drwxr-xr-x 2 www-data www-data 1024 2006-01-14 16:36 .
drwxr-xr-x 6 root root 1024 2006-01-14 16:15 ..
-rw-r--r-- 1 www-data www-data 1144 2006-01-14 12:20 apache_logo.jpg
-rw-r--r-- 1 www-data www-data 151 2006-01-14 16:36 icon_pdf.gif
-rw-r--r-- 1 www-data www-data 2467 2006-01-14 12:20 linux_penguin.png
-rw-r--r-- 1 www-data www-data 2131 2006-01-14 12:20 mysql_logo.jpg
-rw-r--r-- 1 www-data www-data 2471 2006-01-14 12:20 OOo.jpg
-rw-r--r-- 1 www-data www-data 3172 2006-01-14 12:20 php_logo_large.png

acid_kewpie 01-15-2006 08:32 AM

don't spam us just to get past 5 posts... you won't last long here if you do stuff like that again.

JimBass 01-15-2006 08:51 AM

First it is funny you spammed to get the 5 posts for links, because we can't get to 192.168.* addresses over the internet. We'd need access to your LAN to see those pages.

In answer to your question, something is misconfigured in Apache. We can't see your httpd.conf or apache.conf, because you did not post them. You also didn't tell us your distro, but /var/www usually contains directories, like /var/www/site1, /var/www/site2, and those directories are what are live, not the generic /var/www/. Giving us the results of
Code:

ls -al /var/www
would probablly clear up any problems.

I would also check your logs. Apache can be set to log anywhere, on my system it is /var/log/apache/(sitename)/, and in that directory are both the access.log and the error.log. Read the end of the error log, and that will help figure things out.

If you move the images directory to be a subdirectory of the live directory, things should be live.

Peace,
JimBass

kylee 01-15-2006 10:49 PM

I have tried an hour to make the post rid of any assemblace to a url but to no avail. A reference to linux_penguin.png was taken as a url by linuxquestions sytems if I am not mistaken.

Your comments are valuable. Please offer some guidance.

I am running Apache 1.3 on a Debian Sarge. Here is the directory listing of /var/www:
# ls -l /var/www
total 14
drwxr-xr-x 2 www-data www-data 1024 2006-01-14 16:34 courses
drwxr-xr-x 2 www-data www-data 1024 2006-01-15 18:10 images
drwxr-xr-x 2 www-data www-data 1024 2006-01-14 16:36 images2
-rw-r--r-- 1 www-data www-data 2252 2006-01-16 11:56 index.html
-rw-r--r-- 1 www-data www-data 5258 2006-01-13 19:25 index.html.org
-rw-r--r-- 1 www-data www-data 1594 2006-01-16 11:57 learnLinux.html

And the apache configuration file:
##
## httpd.conf -- Apache HTTP server configuration file
##

### Section 1: Global Environment

ServerType standalone

ServerRoot /etc/apache

LockFile /var/lock/apache.lock

PidFile /var/run/apache.pid

ScoreBoardFile /var/run/apache.scoreboard

#ResourceConfig /etc/apache/srm.conf
#AccessConfig /etc/apache/access.conf

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

MinSpareServers 5
MaxSpareServers 10

StartServers 5

MaxClients 150

MaxRequestsPerChild 100

#Listen 3000
#Listen 12.34.56.78:80

#BindAddress *

Include /etc/apache/modules.conf

<IfModule mod_status.c>
ExtendedStatus On
</IfModule>

### Section 2: 'Main' server configuration
Port 80

User www-data
Group www-data

ServerAdmin webmaster@localhost

ServerName localhost

DocumentRoot /var/www

<Directory />
Options SymLinksIfOwnerMatch
AllowOverride None
</Directory>

<Directory /var/www/>
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<IfModule mod_userdir.c>
UserDir public_html
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<Limit PUT DELETE PATCH PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
Order deny,allow
Deny from all
</Limit>
</Directory>
</IfModule>

<IfModule mod_dir.c>
DirectoryIndex index.html index.htm index.shtml index.cgi index.php
</IfModule>

AccessFileName .htaccess

<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>

#CacheNegotiatedDocs

UseCanonicalName Off

TypesConfig /etc/mime.types

DefaultType text/plain

<IfModule mod_mime_magic.c>
MIMEMagicFile /usr/share/misc/file/magic.mime
</IfModule>

HostnameLookups Off

ErrorLog /var/log/apache/error.log

LogLevel warn

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{forensic-id}n\" %T %v" full
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{forensic-id}n\" %P %T" debug
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{forensic-id}n\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{forensic-id}n\"" forensic
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

#CustomLog /var/log/apache/access.log common
#CustomLog /var/log/apache/referer.log referer
#CustomLog /var/log/apache/agent.log agent

CustomLog /var/log/apache/access.log combined

<IfModule mod_log_forensic.c>
ForensicLog /var/log/apache/forensic.log
</IfModule>

<IfModule mod_backtrace.c>
EnableExceptionHook On
</IfModule>

<IfModule mod_whatkilledus.c>
EnableExceptionHook On
</IfModule>

ServerSignature On

#ServerTokens Full

<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>

<IfModule mod_alias.c>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory /usr/lib/cgi-bini/>
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
</IfModule>

<IfModule mod_autoindex.c>
IndexOptions FancyIndexing NameWidth=*

AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
AddIcon /icons/deb.gif .deb

AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^

DefaultIcon /icons/unknown.gif

ReadmeName README.html
HeaderName HEADER.html

IndexIgnore .??* *~ *# HEADER.html HEADER.txt RCS CVS *,v *,t

</IfModule>

<IfModule mod_mime.c>

AddEncoding x-compress Z
AddEncoding x-gzip gz tgz

AddLanguage da .dk
AddLanguage nl .nl
AddLanguage en .en
AddLanguage et .ee
AddLanguage fr .fr
AddLanguage de .de
AddLanguage el .el
AddLanguage it .it
AddLanguage ja .ja
AddCharset ISO-2022-JP .jis
AddLanguage pl .po
AddCharset ISO-8859-2 .iso-pl
AddLanguage pt .pt
AddLanguage pt-br .pt-br
AddLanguage lb .lu
AddLanguage ca .ca
AddLanguage es .es
AddLanguage sv .se
AddLanguage cs .cz

<IfModule mod_negotiation.c>
LanguagePriority en da nl et fr de el it ja pl pt pt-br lb ca es sv
</IfModule>

AddType application/x-tar .tgz
AddType image/bmp .bmp

AddType text/x-hdml .hdml


<IfModule mod_include.c>
AddType text/html .shtml
AddHandler server-parsed .shtml
</IfModule>

</IfModule>

AddDefaultCharset on

<IfModule mod_setenvif.c>
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0

BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
</IfModule>


<IfModule mod_perl.c>
<IfModule mod_alias.c>
Alias /perl/ /var/www/perl/
</IfModule>
<Location /perl>
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
</Location>
</IfModule>

<IfModule mod_alias.c>
Alias /doc/ /usr/share/doc/
</IfModule>

<Location /doc>
order deny,allow
deny from all
allow from 127.0.0.0/255.0.0.0
Options Indexes FollowSymLinks MultiViews
</Location>

<IfModule mod_proxy.c>

</IfModule>

### Section 3: Virtual Hosts
Include /etc/apache/conf.d

btmiller 01-15-2006 11:14 PM

Quote:

Alias /images/ /usr/share/images/
This line is your problem. It tells the Web server to use /usr/share/images as the directory to serve up requests for any requests in /images.


All times are GMT -5. The time now is 05:00 PM.