What permissions to use for web access?

Discussion in 'Web Design and Development' started by ppc_michael, Aug 1, 2007.

  1. ppc_michael Guest

    ppc_michael

    Joined:
    Apr 26, 2005
    Location:
    Los Angeles, CA
    #1
    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?
     
  2. stndn macrumors member

    Joined:
    Oct 22, 2006
    Location:
    earth
    #2
    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.
     
  3. ppc_michael thread starter Guest

    ppc_michael

    Joined:
    Apr 26, 2005
    Location:
    Los Angeles, CA
    #3
    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. :/
     
  4. telecomm macrumors 65816

    telecomm

    Joined:
    Nov 30, 2003
    Location:
    Rome
    #4
    Might emptying your browser cache help here too? (Once the permissions issue is corrected.)
     
  5. stndn macrumors member

    Joined:
    Oct 22, 2006
    Location:
    earth
    #5
    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.
     
  6. ppc_michael thread starter Guest

    ppc_michael

    Joined:
    Apr 26, 2005
    Location:
    Los Angeles, CA
    #6
    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!
     

Share This Page