What permissions to use for web access?

ppc_michael

Guest
Original poster
Apr 26, 2005
1,498
2
Los Angeles, CA
I'm trying to host a site from my MacBook Pro. I want people to be able to access my ~/Pictures directory from their web browsers (I wrote a little index.php that organizes and thumbnails all the pictures).

So I changed my DocumentRoot in httpd.conf to /Users/mjordan/Pictures, restarted apache, and I get a Forbidden error in my browser when I go to localhost.

So I looked at /Library/WebServer/Documents/ (the default DocumentRoot) and recursively applied the permissions that folder uses to my Pictures folder, but I still get a Forbidden.

What permissions (or other settings) should I be using on my Pictures folder (and its files) to make this work?
 

stndn

macrumors member
Oct 22, 2006
79
0
earth
For directory, try: chmod 755 dirname
For files, try: chmod 644 filename

Translation:
755 = allow owner to do everything, while allow groups and others to read and access
644 = allow owner to read and write, while allow groups and others to read only

Also, since you are using index.php as your entry file, make sure you set the configuration in apache to treat that file as the index file if there is no index.html. Otherwise I think by default apache will disallow directory browsing, which may cause the forbidden error as well.

-stndn.
 

ppc_michael

Guest
Original poster
Apr 26, 2005
1,498
2
Los Angeles, CA
Thanks for the reply.

I tried chmod -R 755 Pictures but it didn't work. I do have an index.html file in there for right now, just to make sure that isn't an issue.

Ugh it's so frustrating! I've had this working successfully for years, but I moved to a new computer and can't set it up again. :/
 

telecomm

macrumors 65816
Nov 30, 2003
1,371
8
Rome
Might emptying your browser cache help here too? (Once the permissions issue is corrected.)
 

stndn

macrumors member
Oct 22, 2006
79
0
earth
Just to make sure: Did you also try http://localhost/index.html instead of just http://localhost/, and still got access denied?

Maybe it's time to take a look at your apache logs.
I forgot where it's put at by default (is it /var/log/httpd/ ?), but take a look at the access_log and find out the part where it says forbidden. See if you can make something out of it.

Otherwise, check the httpd.conf again and make sure that under the <Directory> of your pages does not have Deny from all in it.

That's about all I can think of to check for now. Not sure if it helps.


-stndn.
 

ppc_michael

Guest
Original poster
Apr 26, 2005
1,498
2
Los Angeles, CA
Solved

Thank you all for your help!

I don't really understand why, but when I chmod'd my home directory (like, one level up from the Pictures directory), everything worked. *shrug*

Thanks again!