PDA

View Full Version : 403 Apache error?




tonio
Feb 4, 2003, 11:01 AM
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...



monkeydo_jb
Feb 4, 2003, 11:40 AM
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

tonio
Feb 4, 2003, 12:38 PM
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

emlyn
Feb 4, 2003, 01:12 PM
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

emlyn
Feb 4, 2003, 01:14 PM
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.

tonio
Feb 4, 2003, 10:00 PM
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!

emlyn
Feb 4, 2003, 10:19 PM
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/

tonio
Feb 4, 2003, 10:52 PM
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

MacBandit
Apr 30, 2003, 01:29 AM
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.

tonio
May 1, 2003, 01:19 PM
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?

MacBandit
May 1, 2003, 06:52 PM
Originally posted by tonio
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?

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.

[Wed Apr 30 00:19:40 2003] [error] [client 12.225.135.132] Directory index forbidden by rule: /Users/louis/Sites/

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.

Rower_CPU
May 1, 2003, 07:09 PM
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. :)

MacBandit
May 1, 2003, 07:20 PM
Originally posted by Rower_CPU
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. :)

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/.

Rower_CPU
May 1, 2003, 07:32 PM
Did you do an "ls -la" to check the permissions on the folder?

Also, http://localhost/~user/ (or http://127.0.0.1/~user/) is all you need.

MacBandit
May 2, 2003, 01:19 AM
Originally posted by Rower_CPU
Also, http://localhost/~user/ (or http://127.0.0.1/~user/) is all you need.

You mean to attempt access to my personal file sharing folder through an browser don't you?

Or are you referring to something else?

tonio
May 2, 2003, 10:29 AM
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

MacBandit
May 2, 2003, 12:01 PM
Originally posted by tonio
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

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.

Rower_CPU
May 2, 2003, 12:15 PM
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. :)

MacBandit
May 2, 2003, 12:30 PM
Originally posted by Rower_CPU
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. :)

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.

drwxr-xr-x 23 louis admin 782 May 2 09:49 Sites.

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.

[12-225-135-132:~] louis% ls -la ~/sites
total 2936
drwxr-xr-x 23 louis admin 782 May 2 09:49 .
drwxrwxr-x 24 root admin 816 May 2 09:49 ..
-rwxrwxr-x 1 louis admin 21508 May 2 09:49 .DS_Store
-rw-rw-r-- 1 louis admin 0 Feb 1 17:43 .localized
drwxrwxr-x 18 louis admin 612 Feb 11 23:36 Annie's Going away party for the Army 11:29:02
drwxrwxr-x 5 louis admin 170 Dec 31 22:06 Ashley
drwxrwxr-x 23 louis admin 782 Feb 11 23:37 Brew Fest 12:27:02 at Troy's
drwxrwxr-x 5 louis admin 170 May 2 09:49 CGI-Executables
drwxrwxr-x 21 louis admin 714 Feb 11 23:40 Cadburry
drwxrwxr-x 61 louis admin 2074 Feb 12 00:15 Camping 02:08-09:03
drwxrwxr-x 90 louis admin 3060 Feb 11 23:37 Camping 1:18-19:03
drwxrwxr-x 5 louis admin 170 Mar 12 08:28 Camping Mt. June 11-02-02
drwxrwxr-x 16 louis admin 544 Feb 11 23:39 Christmas 2002 Bridget's Family
drwxrwxr-x 15 louis admin 510 Feb 11 23:39 Christmas 2002 at Bridget's Parents
drwxrwxr-x 78 louis admin 2652 Feb 11 23:40 Las Vegas, NV 11:15-17:02
-rwxrwxr-x 1 louis admin 179698 Dec 1 11:49 Me, Bridget having breakfast at the Corner Cafe the last day they were open.JPG
-rwxrwxr-x 1 root admin 1263544 Dec 7 17:43 My Computer Setup.JPG
-rw-rw-r-- 1 louis admin 28532 Apr 3 17:39 Resume.cwk
drwxrwxr-x 8 louis admin 272 Mar 31 19:00 San Francisco Trip 03:18-22:03
drwxrwxr-x 40 louis admin 1360 Feb 11 23:40 Seattle International Motorcycle Show 12:02
drwxrwxr-x 12 louis admin 408 Feb 11 23:40 Sunday Drive 01:05:03
drwxrwxr-x 45 louis admin 1530 Mar 5 09:30 Sunday Drive 02:16:03
drwxrwxr-x 13 louis admin 442 Feb 11 23:40 Target Practice 12:29:02 Gravel Pit near Eagle's Rest

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

drwxrwxr-x 37 root admin 1258 May 2 10:29 Documents

Rower_CPU
May 2, 2003, 01:04 PM
OK, then what's the problem? It sounds like you got everything working...

MacBandit
May 2, 2003, 02:15 PM
Originally posted by Rower_CPU
OK, then what's the problem? It sounds like you got everything working...

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.

Rower_CPU
May 2, 2003, 04:09 PM
Originally posted by MacBandit
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.

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.

MacBandit
May 5, 2003, 01:29 AM
Originally posted by Rower_CPU
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.

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

MacBandit
May 5, 2003, 01:54 AM
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

Rower_CPU
May 5, 2003, 02:14 AM
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.

MacBandit
May 5, 2003, 02:38 AM
Thanks.

Well I can tell you one thing for sure. It say's that I don't have permission but it has nothing to do with the folder permissions. I opened it up for UGO=RWX. That did not do it. I checked and my user folder carries the same permissions as the root/library folder. So it isn't a hiearchy permissions fault either. I guess there must be a system glitch somewhere. I guess we'll find out when 10.2.6 comes out and I do reinstall.

Have you checked into my binding problem?

More then anything you have been teaching me a lot about the terminal. You give me a command and then I do a MAN on it and find out all about it. Then I tinker cautiously. I've learned a lot and gained a lot of (probably false) confidence. Thanks.

Rower_CPU
May 5, 2003, 12:31 PM
Hey, glad to help. What I knew about Unix before OS X you could fit into a small thimble. X has been a great opportunity for me to learn some new stuff.

As for your prebinding issue...not a clue. It looks like it's hanging on some Cocoa library. That's about all I can tell you. Does it do that will all the different options or just when you run from "-root /"?

MacBandit
May 5, 2003, 12:38 PM
Originally posted by Rower_CPU
Hey, glad to help. What I knew about Unix before OS X you could fit into a small thimble. X has been a great opportunity for me to learn some new stuff.

As for your prebinding issue...not a clue. It looks like it's hanging on some Cocoa library. That's about all I can tell you. Does it do that will all the different options or just when you run from "-root /"?

It doesn't seem to matter the option it just hangs. Maybe it's the same problem that's keeping my files from showing with Personal File Sharing. Once again hopefully this will all be fixed by a reinstall which I will do when they release 10.2.6.

Rower_CPU
May 5, 2003, 11:05 PM
Originally posted by MacBandit
It doesn't seem to matter the option it just hangs. Maybe it's the same problem that's keeping my files from showing with Personal File Sharing. Once again hopefully this will all be fixed by a reinstall which I will do when they release 10.2.6.

I'm not convinced that there will be a 10.2.6...at least for server. We'll see.

MacBandit
May 6, 2003, 12:52 AM
Originally posted by Rower_CPU
I'm not convinced that there will be a 10.2.6...at least for server. We'll see.

There seems to be a lot more bugs in 10.2.5 then there was in 10.2.4. For that simple reason I think there will be a bug fix release. I do not believe Panther will be released until later this summer so I don't think they are going to make us wait on the bug fixes. Also I am convinced that 10.3 will be a pay upgrade so they once again will want to fix the bugs with 10.2.5 so that they don't have a ton of complaints about dropping a buggy system on everyone then charging to have it fixed.

MacBandit
May 7, 2003, 02:36 AM
Well I did an archive install and copy prefs over. Guess what I still had the problem trying to access files on the Apache servers at ~.

So I did another install this time without the option of copying stuff over. Now it works. So I guess we know now that somehow I screwed it up. Oh, well I have everything back to the way it was with all my files and everything in the right place and the Apache/files are accessible.

I checked on my folding error and it is still giving me the same error even right after I installed before I updated or did anything. Kind of funny huh. I'm thinking there's some kind of hard drive error that fsck -y isn't picking up.

Rower_CPU
May 7, 2003, 12:23 PM
Yeah, I've got this great thing going in fsck -y where one step says "there should be 10267 files instead of 10268" and then the next step says "there should be 10268 files instead of 10267". :rolleyes:

I'm going to do a format and re-install one of these days to clear it up. I hope it fixes my Firewire issues, too.

Anyway, glad you got your sites sorted.

BTW, I was officially wrong about the 10.2.6 Client update. Just when you think you know what to expect from Apple...;)

MacBandit
May 7, 2003, 04:48 PM
Originally posted by Rower_CPU
BTW, I was officially wrong about the 10.2.6 Client update. Just when you think you know what to expect from Apple...;)

Hey no need to apologize I already new you were wrong.:p

Hey if you're interested my sites folder is linked off my homepage.

Rower_CPU
May 7, 2003, 04:52 PM
Originally posted by MacBandit
Hey no need to apologize I already new you were wrong.:p

Hey if you're interested my sites folder is linked off my homepage.

Sure, rub it in...

Which link is it? I read like 20 and gave up...:p

MacBandit
May 7, 2003, 05:03 PM
Originally posted by Rower_CPU
Sure, rub it in...

Which link is it? I read like 20 and gave up...:p

The one at the bottom on the right that says original images.

Rower_CPU
May 7, 2003, 05:52 PM
Originally posted by MacBandit
The one at the bottom on the right that says original images.

Got it. Don't you wish that ISPs would uncap upstream traffic?

MacBandit
May 8, 2003, 01:22 AM
Originally posted by Rower_CPU
OK, crontab can be kind of tricky to deal with. It's essentially a list of commands and specific time(s) to run them.

Typing 'crontab -l' in Terminal will list your current crontab, if one exists.

Typing 'crontab -e' will dump you into the vi editor, which is very powerful compared to pico, but very complex as well.

I can walk you through it, but it's a little tricky.

I know what cron does I've just never used it. If you're up to writing a short tutorial I'm up to doing it. Anything to teach me more about using the terminal.