403 Apache error?

Discussion in 'Mac Help/Tips' started by tonio, Feb 4, 2003.

  1. tonio macrumors newbie

    Joined:
    Feb 4, 2003
    #1
    403 error when trying to access Jaguar box from Win XP pro box OR my own mac's browser (any...explorer, safari)...

    I recently added a PC running Win XP Pro to my home network; I'm using a Linksys router with a cable modem-there's 2 imacs (running os x 10.2.3) and the above=mentioned PC-it's a hard-wired network, each computer has internet access...After enabling Windows filesharing and Personal Web sharing on my mac, I can "see" the PC on the mac and mount the designated shared folders on my mac desktop...great...

    Now. I want to be able to get files from my mac using the PC, and i didn't want to use ftp, so i read that files put in the Users/my name/sites folder could be accessed through the web browser on my PC-even if they were not index.html documents...I read that if any files named index.html were removed, then any file i put in there would be listed in a directory and available for download...now, the default index.html document, the one that welcomes you to Apache, I CAN read from the PC browser (explorer) after putting http://192.168.1.101/~my name/etc, etc ...However, when I remove the index.html file, I get a 403 error (you do not have permission to access ... on this server) message on the PC Browser...

    How to I enable permissions to allow the PC access to an index directory? Is that something I have to do in Terminal? If so, how can I do that? I'm not too comfortable with UNIX at all...I just want the files I put in the "sites" folder to be listed, without them being html documents, so i can occasionally just pull a file from my mac on to my PC...

    thank you for any help anyone may be able to give me...
     
  2. monkeydo_jb macrumors 6502

    Joined:
    Apr 17, 2002
    Location:
    Columbia, MO
    #2
    Your problem stems from the fact that you can't view the contents of a web server's root directory.

    Put index.html back. Next create a folder inside of your 'sites' folder. Put all your files into it. That should be all (considering you have permissions set properly). Point XPs browser to http://192.168.1.101/~my name/directory name and that should be it.

    Let me know if this helps.


    -jeff
     
  3. tonio thread starter macrumors newbie

    Joined:
    Feb 4, 2003
    #3
    hmmmm....

    thanks Jeff...I REALLY appreciate your reply...

    i still couldn't get a directory listed...when you said put the index.html document back, i assume you meant the default sample document that comes in that folder (along with the sample "images" folder)...i created a folder in my "sites" folder named "misc" and put 3 jpegs in it...i couldn't view anything, again, but the sample html document welcoming you to Apache...i restarted Apache (via personal web sharing button in "sharing") after each change...it seems that if it can't find an html document i get that 403 error...and idf that sample document is in there, that's all i can view...

    could you perhaps provide a little more info on settings permissions, as you mentioned above? do you mean set them by clicking the "get info" option for a folder or document? once there, how and what exactly should i set that to? do i have to use that "indexing" option there? i logged in as root and tried to index the folder, but that didn't help either...

    i know i really don't understand Apache, and i apologize if i'm asking illogical questions...again dude...thnx for the help, i really appreciate it..

    tony
     
  4. emlyn macrumors newbie

    Joined:
    Feb 4, 2003
    #4
    HTML Indexes in Apache

    Look in /etc/httpd/httpd.conf and find this region:

    ----
    #<Directory /home/*/Sites>
    # AllowOverride FileInfo AuthConfig Limit
    # Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    # <Limit GET POST OPTIONS PROPFIND>
    # Order allow,deny
    # Allow from all
    # </Limit>
    # <LimitExcept GET POST OPTIONS PROPFIND>
    # Order deny,allow
    # Deny from all
    # </LimitExcept>
    #</Directory>
    ----

    This section defines the options for users' personal pages (~/Sites directories). The key line here is "Options Indexes". It should already be there so all you need to do is uncomment (remove the # from the beginning of each line) this entire region.

    If you don't know enough about UNIX to get to this (hidden to the finder) file here is a quick summary:

    * launch terminal
    * type "sudo pico /etc/httpd/httpd.conf" [enter]
    * enter your password
    * use the arrow keys and delete to navigate and modify the file
    * press "ctrl-x"
    * press "y" for yes I want to save
    * press [enter] for the filename
     
  5. emlyn macrumors newbie

    Joined:
    Feb 4, 2003
    #5
    Doh... one more thing. You must restart apache after changing it's configuration file! All you need to do is go to sharing in the "System Preferences" and press stop and start on personal web sharing.
     
  6. tonio thread starter macrumors newbie

    Joined:
    Feb 4, 2003
    #6
    help!

    i followed the instructions in the above post...but now, in the "sharing" pane under system preferences, whe i try to turn on "personal web sharing"...it doesn't start...it says "persoanl web sharing starting up...." but it never completes the process, it just hangs there...i can start and stop other sharing options though...do you think i screwed up in Terminal? do you think i have to reinstall Jaguar to repair the file now?

    Wow...aren't computers great?

    :)

    thanks!
     
  7. emlyn macrumors newbie

    Joined:
    Feb 4, 2003
    #7
    Reinstall? Nah, of course not. You probably just made a typo in the config file (which can be re-commented out). If you are really at a loss to fix it you can just copy someone else's config file. For the exact error in the config file open the terminal and type:

    sudo httpd

    Apache is a text mode UNIX program so its error messages are outputted through the console. I made a mistake in my config file for demonstration purposes and this is what it said:

    Syntax error on line 1 of /etc/httpd/httpd.conf:
    Invalid command 'this', perhaps mis-spelled or defined by a module not included in the server configuration

    For more information on configuring Apache, check out the Apache manual:

    http://httpd.apache.org/docs/
     
  8. tonio thread starter macrumors newbie

    Joined:
    Feb 4, 2003
    #8
    wow...am i annoying you guys yet?

    ok...i found the lines with syntax errors...i removed a few too many #'s ...so i, in fact, MAY BE as dumb as i look.... ;)

    However...the only page i can view in my browser is still the sample html document...any other document or folder in the user/sites folder gives me the 403 error...

    i looked at your sample conf file, and mine matches yours...in that whole region there are no #'s at the start of any line....

    any other ideas? or have i exhausted your goodwill?

    thank you again...

    tony
     
  9. MacBandit macrumors 604

    MacBandit

    Joined:
    Aug 9, 2002
    Location:
    Springfield, OR (Home of the Simpsons)
    #9
    Did you ever get your personal web sharing working?

    I am currently in the same boat as you. As far as I know my personal web sharing was working in 10.2.4 (could have been 10.2.3) in any case it doesn't work now. All I had was the file in the my sites folder and it worked.
     
  10. tonio thread starter macrumors newbie

    Joined:
    Feb 4, 2003
    #10
    hmmm...

    my problem was that i screwed up when i edited a UNIX file in Terminal, as referred to in emlyn's post above...yours seems to be related to an upgrade or a change in your OS, right? You said it did work, and now it doesn't...once i correctly re-edited the UNIX file, personal web sharing worked again...

    what modifications have you made?
     
  11. MacBandit macrumors 604

    MacBandit

    Joined:
    Aug 9, 2002
    Location:
    Springfield, OR (Home of the Simpsons)
    #11
    Re: hmmm...

    No mods. I don't even run any haxies or system mods of any sort. The only thing I may have done is change the system permissions. I guess I need to know what my home folder and sites folders permissions should be.

    I delved into the terminal the other night and found the error log file and this is what is giving me when I try to access my Personal Web Sharing.

    The funny thing is if I have the default html file in the folder I can access that but if I remove it I can not access the files. It could still be a permissions thing though.
     
  12. Rower_CPU Moderator emeritus

    Rower_CPU

    Joined:
    Oct 5, 2001
    Location:
    San Diego, CA
    #12
    It's all about permissions.

    They need to be read AND execute for the "all users" category. So do this:

    chmod 755 Sites/

    Works like a charm. :)
     
  13. MacBandit macrumors 604

    MacBandit

    Joined:
    Aug 9, 2002
    Location:
    Springfield, OR (Home of the Simpsons)
    #13
    I ran put that in the terminal and it appears to do something but it doesn't print a result it just comes back with a prompt.

    It didn't change anything though. I even tried ~user/sites/.
     
  14. Rower_CPU Moderator emeritus

    Rower_CPU

    Joined:
    Oct 5, 2001
    Location:
    San Diego, CA
    #14
  15. MacBandit macrumors 604

    MacBandit

    Joined:
    Aug 9, 2002
    Location:
    Springfield, OR (Home of the Simpsons)
    #15
    You mean to attempt access to my personal file sharing folder through an browser don't you?

    Or are you referring to something else?
     
  16. tonio thread starter macrumors newbie

    Joined:
    Feb 4, 2003
    #16
    in any case....

    if you go into your library/webserver folder, RATHER than the users/"your name" or "home"/sites location, abd remove the existing default documents in there (and then put whatever you want in there), it WILL be accessible from your web browser (removing those documents that are there will allow a directory listing), and therefore over a network, etc....see if that works, then you'll know if your personal sharing option is screwed or if it's just a permissions thing, which gets real involved when one is not too comfortable with UNIX and your modifying them in Terminal (like me)...

    maybe not exactly answering all your questions, but i wanted you to be aware of an alternative to getting a simple directory listing for use on the internet....


    tony
     
  17. MacBandit macrumors 604

    MacBandit

    Joined:
    Aug 9, 2002
    Location:
    Springfield, OR (Home of the Simpsons)
    #17
    Re: in any case....

    Thanks that helped some. I had been looking for the folder where the system kept the Apache files.

    So here's what I have found if I put some files in the ~/library/webserver/documents folder then I can see them by accessing the system Apache webserver instead of the users webserver.

    I tried correcting the permissions (in the finder not the terminal) so they matched that of the system folders but that didn't fix it. I have a feeling that I need to change this in the terminal. If someone could explain to me what to do I will do it.
     
  18. Rower_CPU Moderator emeritus

    Rower_CPU

    Joined:
    Oct 5, 2001
    Location:
    San Diego, CA
    #18
    OK, a couple things to clear up:

    1) http://localhost/~user/ = Your personal site when accessed via a browser

    2) The general webserver is located at /Library/WebServer/Documents NOT ~/Library/WebServer/Documents. There's a big difference. ~ refers to your home directory.

    OK, MacBandit, follow these directions:

    To enable directory listings in your personal web folder -
    -Open Terminal
    -Type "pwd" to see what directory you're in. It should say /Users/username
    -Type "chmod 755 Sites/"
    -Type "ls -la" to see the directories and their properties. The line with the Sites folder should look something this
    drwxr-xr-x 5 username staff 170 Dec 6 11:40 Sites

    The important part is the drwxr-xr-x part, which shows that all user and can read and execute within the folder.

    To enable directory listing in the main web folder-
    -Open Terminal
    -Type "cd /Library/WebServer/"
    -Type "chmod 755 Documents/"
    -Type "ls -la" to see the directories and their properties. The line with the Documents folder should look something this
    drwxrwxr-x 9 root admin 306 Apr 30 10:57 Documents

    The important part is the drwxr-xr-x part, which shows that all user and can read and execute within the folder.



    That should do the trick. :)
     
  19. MacBandit macrumors 604

    MacBandit

    Joined:
    Aug 9, 2002
    Location:
    Springfield, OR (Home of the Simpsons)
    #19
    Okay quickly the main web folder I can already access file in if I put them in there.

    My ~/Sites folder has the correct permissions already.

    I didn't change anything. It already had the correct settings.

    I don't know if this makes a difference but here is the settings for everything within the folder.

    Here's the settings for the /library/webserver/documents folder. If I put files here I can access them currently.

     
  20. Rower_CPU Moderator emeritus

    Rower_CPU

    Joined:
    Oct 5, 2001
    Location:
    San Diego, CA
    #20
    OK, then what's the problem? It sounds like you got everything working...
     
  21. MacBandit macrumors 604

    MacBandit

    Joined:
    Aug 9, 2002
    Location:
    Springfield, OR (Home of the Simpsons)
    #21
    No, I can acess the system Apache server and can put files in there and see them. I can access the ~/user Apacher server and see the index.html but if I replace that with files I can not see them.
     
  22. Rower_CPU Moderator emeritus

    Rower_CPU

    Joined:
    Oct 5, 2001
    Location:
    San Diego, CA
    #22
    That's weird. Mine works fine with those permissions, and I didn't mess with httpd.conf either...weirdness.

    At least the system one works fine.
     
  23. MacBandit macrumors 604

    MacBandit

    Joined:
    Aug 9, 2002
    Location:
    Springfield, OR (Home of the Simpsons)
    #23
    Hey thanks for all the help. I'll keep working on this and if I figure it out I'll let you know. Meanwhile I have another problem within the terminal. If you would take a look at this for me.

    http://forums.macrumors.com/showthread.php?s=&threadid=25948
     
  24. MacBandit macrumors 604

    MacBandit

    Joined:
    Aug 9, 2002
    Location:
    Springfield, OR (Home of the Simpsons)
    #24
    How do I change the permissions on a file in the terminal.

    This is what they are now.

    drwxr-xr-x 22 louis guest 748 May 4 23:42 Sites

    I would like to change it to try this.

    drwxrwxrwx
     
  25. Rower_CPU Moderator emeritus

    Rower_CPU

    Joined:
    Oct 5, 2001
    Location:
    San Diego, CA
    #25
    A quick rundown on file permissions:

    You can use the numbers or letters to add/remove permissions to files/folders with the chmod command.

    For numbers-
    7=rwx
    6=rw-
    5=r-x
    4=r--
    3=-wx
    2=-w-
    1=--x

    Numbering uses a mathematical scale, where execute access is 1, write access is 2 and read access is 4. Combinations of these amounts give you the different permission combinations. 7=4+2+1, thus rwx. The first position is the owner, the second the group and the third is everyone. Thus, rwxrwxrwx mean the user, the group and everyone all have read, write and execute privileges.


    For letters-
    Simply use the +/- signs to add/remove permissions for all users. With your directory with permissions rwxr-xr-x, simply type chmod +w and then the file/directory name. The permissions will then be rwxrwxrwx. Likewise, to remove permissions, use chmod -(letter) to take them away.
     

Share This Page