LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-13-2005, 10:53 PM   #1
Raggit
Member
 
Registered: Oct 2003
Location: N.C USA
Distribution: Fedora Core 4
Posts: 65

Rep: Reputation: 15
Apache directory Confusion


WHere would one put the images folder for a webpage if
apache is setup to run the index.html page from /var/www/html

I've put an images folder in /var/www and my pictures don't show
up when i visit my webpage but all the text does

I've put an iamges folder in /var/www/html and my images don't show
up when i visit my webpage but all the text does

my html is setup as such for an image
Code:
<img src="images/sitrep.jpg" width="512" height="512">
when i visit the webpage i get a big square with a red dot....Please help

Also as a secondary question

If i create an html page as the user i'm signed in as and then
try to view that webpage, it says there is an error, but if i
create teh file as root, then everything is ok for people to
view that html page.
what do i need to do to be signed is as me and create web content
so that it is viewable, i don't really want to have to always be root to
get anything done.

Last edited by Raggit; 02-13-2005 at 10:54 PM.
 
Old 02-14-2005, 12:23 AM   #2
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
When you have your image dir as /var/www/html/images/ it should work with the html you provided. Have you checked the server error_log? Its mostly very useful for debugging "not found" errors. Its most likely located somewhere like /var/log/apache/error_log or similar.

I dont fully understand your seconf question, but Ill try to answer anyways. Make sure the chmods for the files are set to allow reading for the group other. That is the group which under apache should access them. Heres an example:
Code:
# do this as the owner of the file, or root
chmod o+r /var/www/html/file.html
 
Old 02-14-2005, 12:37 AM   #3
jeanpba
LQ Newbie
 
Registered: Oct 2002
Posts: 9

Rep: Reputation: 0
hello Artanicus

check also if the user which runs apache (for example user apache) have correct
rights to descend in the image directory and if the file can be ridden

Hope this helps

Cheers

jeanpba
http://jeanpba.homeip.net
 
Old 02-14-2005, 05:10 AM   #4
kbcnetau
Member
 
Registered: Dec 2003
Location: South Australia (ex-Devon, UK)
Distribution: SuSE, Slackware, Fedora, Debian, Knoppix
Posts: 141

Rep: Reputation: 15
1) If your parent directory (with index.html) is in /var/www/html, your images directory MUST be under that directory (eg /var/www/html) unless you set an alias in the Apache config file. If you wanted to usr /var/www/images as your image directory, you would need to add a line like this into the configuration for your host/virtualhost:

Alias /images /var/www/images

2) All directories must have read AND execute permission for the user running the web server. If no other users have access to your machine, you can just do something like:
chmod 777 /var/www/images

Note that the above will let any user on your system read and write to the directory - take care if you are on a multi-user system.

3) User running web server must have read permission on all files that it has to server. The easy way to do this (and to answer your last question) is to write a little shell script that does this:

chmod 644 /var/www/html/*.html

...repeating for every file type that you are going to serve in that directory. If you decide to put your images in /var/www/html/images, you could:

chmod 644 /var/www/html/*

...but only if that directory contains files only and not subdirectories. (If there were subdirectories in there, you would be taking away the execute (x) permission required to descend into the directory.)

When you've written your script, give it execute permission (chmod 744 myscript) and run it every time you make any changes.

It's late at night, I'm tired, so I hope this makes sense!

Cheers

Matthew
 
Old 02-14-2005, 07:10 AM   #5
pvs
Member
 
Registered: Jan 2005
Location: Lviv, Ukraine
Distribution: Something self-made
Posts: 69

Rep: Reputation: 16
check httpd.conf, maybe there is defined virtual folder called "images"
 
Old 02-14-2005, 08:14 AM   #6
Raggit
Member
 
Registered: Oct 2003
Location: N.C USA
Distribution: Fedora Core 4
Posts: 65

Original Poster
Rep: Reputation: 15
Ok Gents, thanks for all the answers and I've tried to implement your advice but to no avail.
Below you will find the permissions of the images directory.
I've also looked through httpd.conf and found no

Code:
 [mark@linuxbox html]$ pwd
/var/www/html
[mark@linuxbox html]$ ls -l
total 200
drwxr-xr-x  4 root mark   4096 Feb 13 21:47 images
-rw-r--r--  1 mark root   2367 Feb  3 23:12 index.html
-rwxr--r--  1 root mark   9448 Feb 13 17:47 IntelReports.dwt
-rw-r--r--  1 root root     63 Feb 13 01:32 jcm.html
-rw-r--r--  1 root root     65 Feb 10 20:50 mom.html
-rw-r--r--  1 root root  15825 Feb 14 00:03 omaha1.html
-rw-r--r--  1 root root     69 Feb 10 20:54 rudy.html
-rwxr--r--  1 root root 107163 Feb 13 01:33 screener1.jpg
-rw-r--r--  1 root root    121 Feb 11 20:28 trey.html
[mark@linuxbox html]$
In my error_logs I see alot of this
Code:
[Mon Feb 14 09:08:45 2005] [error] [client 66.26.157.109] (13)Permission denied: access to
/images/sitrep.jpg denied
With that in mind it is obviously a permission issue. the user and group is apache but i'm not sure how to determine the rights that user has beside the old fashioned -rwxr-xr-x which would appear to me as if user,group,others have the rights they need to view the files in the images folder.
My images directory is in fact in /var/www/html and all the files that are within that directory have the following permissions -rwxr-xr-x so at this point i'm scratching my head
 
Old 02-14-2005, 08:19 AM   #7
pvs
Member
 
Registered: Jan 2005
Location: Lviv, Ukraine
Distribution: Something self-made
Posts: 69

Rep: Reputation: 16
check who is owner of your images: having file with permissions as yours it should be "apache" or belong to group "apache". try "chown apache:apache *"
 
Old 02-14-2005, 08:24 AM   #8
jeanpba
LQ Newbie
 
Registered: Oct 2002
Posts: 9

Rep: Reputation: 0
Hello Raggit

Could you give us the three commands run with root environnement :

1 / id
2 / id apache
3 / ls -ail images/sitrep.jpg

Because when I see the images directory with root and mark group, if apache is running
with apache anc group apache, the command will fail if the images/siterep.jpg file is not
at least in : in rwxr-xr--

Cheers and enjoy apache !


jeanpba
 
Old 02-14-2005, 08:30 AM   #9
Raggit
Member
 
Registered: Oct 2003
Location: N.C USA
Distribution: Fedora Core 4
Posts: 65

Original Poster
Rep: Reputation: 15
jeanpba

Here is the answers to your questions for th id command

Code:
[root@linuxbox ~]# id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) context=root:system_r:unconfined_t
[root@linuxbox ~]# id apache
uid=48(apache) gid=48(apache) groups=48(apache)
[root@linuxbox ~]# ls -ail /var/www/html/images
total 128
3205849 drwxr-xr-x  4 root mark  4096 Feb 13 21:47 .
3188809 drwxrwxr-x  3 root root  4096 Feb 14 00:03 ..
3205889 -rwxr-xr-x  1 root mark  5887 Feb 13 17:40 cnvbkgnd.jpg
3205855 drwxr-xr-x  2 root mark  4096 Feb 13 21:47 Coalition
3205875 drwxr-xr-x  2 root mark  4096 Feb 13 21:47 Opposistion
3205854 -rwxr-xr-x  1 root mark 75567 Feb 13 18:18 sitrep.jpg
[root@linuxbox ~]#
PVS, how do i check to see who owner is of file??---Sorry, it appears as if root is the owner of the images...I think*
Code:
-rwxr-xr-x  1 root mark  5887 Feb 13 17:40 cnvbkgnd.jpg

Last edited by Raggit; 02-14-2005 at 08:37 AM.
 
Old 02-14-2005, 08:39 AM   #10
pvs
Member
 
Registered: Jan 2005
Location: Lviv, Ukraine
Distribution: Something self-made
Posts: 69

Rep: Reputation: 16
as shows your output to jeanpba file belongs to user "root" and group "mark". You can include user "apache" to group "mark" or chown file to be readable by user or group "apache" (run
"chown apache:mark *" for user apache, group mark or "chown root:apache *" for user root, group apache
or "chown apache:apache *" for both user and group apache)
 
Old 02-14-2005, 08:50 AM   #11
Raggit
Member
 
Registered: Oct 2003
Location: N.C USA
Distribution: Fedora Core 4
Posts: 65

Original Poster
Rep: Reputation: 15
if i goto http://mywebsite.dnsforwarder.net/images
i get a 403 forbidden error.

I changed the owner group of the images directory to apache as reflected below
Code:
drwxr-xr-x  4 apache apache   4096 Feb 13 21:47 images
The bg image of my webpage is the one i'm working with now because
i know if i reload my page and it shows up then all the others will too if
i set their permissions identical to it so i changed its owner group to
apache as well as reflected below.

Code:
-rwxr-xr-x  1 apache apache  5887 Feb 13 17:40 cnvbkgnd.jpg
Still i am unable to enter my /images directory and my background image
does not appear on the page with those changes.
 
Old 02-14-2005, 08:56 AM   #12
pvs
Member
 
Registered: Jan 2005
Location: Lviv, Ukraine
Distribution: Something self-made
Posts: 69

Rep: Reputation: 16
if you can see your webpage but cannot see images try to set ownership of images same as in your main file (index.html or something like that)
 
Old 02-14-2005, 09:04 AM   #13
Raggit
Member
 
Registered: Oct 2003
Location: N.C USA
Distribution: Fedora Core 4
Posts: 65

Original Poster
Rep: Reputation: 15
That has no resolve either and it would appear to me as if the permissions are set correctly

Code:
[root@linuxbox html]# pwd
/var/www/html
[root@linuxbox html]# ls -l
total 200
drwxr-xr-x  4 root root   4096 Feb 13 21:47 images
-rw-r--r--  1 mark root   2367 Feb  3 23:12 index.html
-rwxr--r--  1 root mark   9448 Feb 13 17:47 IntelReports.dwt
-rw-r--r--  1 root root     63 Feb 13 01:32 jcm.html
-rw-r--r--  1 root root     65 Feb 10 20:50 mom.html
-rw-r--r--  1 root root  15825 Feb 14 00:03 omaha1.html
-rw-r--r--  1 root root     69 Feb 10 20:54 rudy.html
-rwxr--r--  1 root root 107163 Feb 13 01:33 screener1.jpg
-rw-r--r--  1 root root    121 Feb 11 20:28 trey.html
[root@linuxbox html]# ls -l images
total 112
-rwxr-xr-x  1 root root  5887 Feb 13 17:40 cnvbkgnd.jpg
drwxr-xr-x  2 root root  4096 Feb 13 21:47 Coalition
drwxr-xr-x  2 root root  4096 Feb 13 21:47 Opposistion
-rwxr-xr-x  1 root root 75567 Feb 13 18:18 sitrep.jpg
[root@linuxbox html]#
 
Old 02-14-2005, 09:12 AM   #14
pvs
Member
 
Registered: Jan 2005
Location: Lviv, Ukraine
Distribution: Something self-made
Posts: 69

Rep: Reputation: 16
can you see screener1.jpg from your page?
 
Old 02-14-2005, 09:14 AM   #15
Raggit
Member
 
Registered: Oct 2003
Location: N.C USA
Distribution: Fedora Core 4
Posts: 65

Original Poster
Rep: Reputation: 15
If i goto
http://mydomain.dnsforwarder.com/images/screener.jpg

I get a 403 error. I am unable to see any images that are contained within that images directory
 
  


Reply


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
Apache Directory Listing Of NFS Mount, cannot view directory list via apache luqmana Linux - Networking 2 12-19-2005 06:03 AM
Confusion in directory in Apache SSL installation john lee Linux - Security 2 12-15-2004 11:45 PM
apache directory Longinus Linux - Software 2 04-05-2004 05:37 AM
Apache directory... Z28kid Linux - Newbie 9 02-17-2003 05:12 PM
apache confusion antken Linux - General 1 08-02-2002 01:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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