Making a folder browsable
I just added a drive to my system now i created a directory in it and am trying to make it browsable by the web server but am having some difficulty doing it.
Do i need to edit httpd.conf or add user apache to the folder. Any help will be greatly appreciated. |
Define "browsable by the web server..." please :)
|
Ok i want to put some folders with music files and enable the user my webserver apache in this case to be able to have access to the folder so that a web application am running can able to access the music files, the only way its working right now is for me to put the music folders either in webserver base or in the public_html folders but i dont wanna do this since this are on the main hard drive and i would like to have my music files on a separate drive.
|
you can just create a Symbolic Link from the Apache root directory to where your files are...
Code:
ln -s /home/myuser/music /var/www/html/music You will have to loosen up your file and folder permissions on the destination directory (/home/myuser/music) The best way is probably to change the group the the group of the web server daemon and allow group Read / Execute permissions: Code:
chgrp apache /home/myuser/music |
thanks fukawi2 i will go try it out
|
Back to the drawing board tried it but it didn't work had my hopes up all day but i will keep looking.
|
I guarantee it works - I do it often.
What error messages are you getting? |
this is the error log that showed up on logwatch
--------------------- httpd Begin ------------------------ Requests with error response codes 403 Forbidden /music: 2 Time(s) i will go and check my logs when i get to the house and add them here thanks fukawi2 coz i know it can work myself i just dont know how yet. |
Can you post the output of the following commands please?
Code:
ls -lh /home/username/ |
ls -lh /home2/muthii/music
total 8.0K drwxrwxr-x 2 muthii muthii 4.0K Dec 26 20:52 kenya mp3 ls -lh /var/www/html total 228K -rw-r--r-- 1 root root 17K Nov 25 14:02 animated_favicon1.gif drwxr-xr-x 5 muthii muthii 4.0K Aug 12 2006 blog drwxrwxr-x 8 muthii muthii 4.0K Jul 21 2006 calender -rw-r--r-- 1 muthii muthii 4.3K Jul 19 2006 contact2.php -rw-r--r-- 1 root root 4.4K Aug 5 2006 contact.php -rw-r--r-- 1 root root 17K Dec 5 16:39 favico.gif -rw-r--r-- 1 root root 3.6K Nov 25 14:00 favicon.ico drwxr-xr-x 10 muthii muthii 4.0K Jul 11 2006 forum drwxr-xr-x 3 muthii muthii 4.0K May 12 14:19 images -rwxr--r-- 1 muthii muthii 19K May 12 14:32 index.html -rwxr-xr-x 1 muthii root 298 Mar 19 13:30 index.html~ -rw-rw-r-- 1 muthii muthii 20K Apr 28 23:21 links.html drwxrwxr-x 16 muthii muthii 4.0K Oct 12 2006 mail lrwxrwxrwx 1 root root 19 May 11 17:30 music -> /home2/muthii/music nb: removed unnecessary listings on second command to other folders. Hope this helps. |
You forgot the 2 'id' commands :)
|
there is my id
id muthii uid=500(muthii) gid=500(muthii) groups=500(muthii),0(root) id apache uid=48(apache) gid=48(apache) groups=48(apache) |
Sounds like just a permissions problem - your apache and muthii user don't overlap at all; ie, to each other, they both fall under the "other" group.
It might even be a problem with the /home2 directory permissions, but probably with /home2/muthii which probably has rwx------ permissions (ie, no access for the group or "other") 3 solutions: 1) Add apache to your user group 2) Change the group ownership on all the file / directories that Apache needs to access and give group at least Read access to files and r-x access to directories 3) Change all the directories that Apache needs to access to have r-- for files and r-x for directories to the "other" group (not recommended from a security point of view.) |
Quote:
http://systemnotesorg.blogspot.com/2...otes-http.html You can check with ls -Z /var/www/html ls -Z /home2/muthii/music And probably fix it with this: chcon -R --reference /var/www/html /home2/muthii/music |
thank you for both replies i will go and try it out
|
All times are GMT -5. The time now is 09:18 PM. |