500 internal server error

Hi,

I read a lot about those errors but always when someone was using .htaccess file. Apache documentation says you dont have to use it. Instead you write everything in <Directory> and off you go. Well, not in my case - I always get that error after providing correct password.

I've got modules: file, basic, mime, dir and host loaded.

At the end of httpd.conf I added this:
Code:
<Directory /usr/local/www/apache22/data/photos>
AuthType Basic
AuthName "private"
AuthBasicProvider file
AuthUserFile /usr/local/www/apache22/passwd/passwords
Require valid-user
</Directory>

Tried with valid-user as well as user particular_user. Same thing happens.

Anything I'm missing ?

Thanks,
K.
 
Yes, forgot to mention:

Code:
[Mon Sep 06 20:00:52 2010] [crit] [client 192.168.1.10] configuration error:
couldn't check access.  Check your 'Require' directive: /photos/photos.html, referer:
http://192.168.1.1/

All 1 line, but i split it so it was easier to read ;]

K.
 
Is the www user able to read the file /usr/local/www/apache22/passwd/passwords?

Did you create that file with htpasswd(1)?
 
Is the www user able to read the file /usr/local/www/apache22/passwd/passwords?

I would think so - both folder and file are read for everyone.

Did you create that file with htpasswd(1)?

Yes, I used [cmd=]htpasswd -c /usr/local/www/apache22/passwd/passwords username[/cmd]

K.
 
Code:
# ls -l /usr/local/www/apache22/passwd/
total 2
-rw-r--r--  1 root  wheel  22 Sep  6 19:51 passwords

# ls -l /usr/local/www/apache22/
total 12
drwxr-xr-x  2 root  wheel   512 Sep  6 15:51 cgi-bin
drwxr-xr-x  3 root  wheel   512 Sep  7 12:33 data
drwxr-xr-x  3 root  wheel  1024 Sep  6 15:51 error
drwxr-xr-x  3 root  wheel  3584 Sep  6 15:51 icons
drwxr-xr-x  2 root  wheel   512 Sep  6 15:56 passwd

That's what I have. Based on this my limited knowledge of FreeBSD tells me, that user www should have no problem reading the file.

I also tried something else just a second ago. I created a new test password file inside data folder, where www user has to have access to get all .html files, right? I gave it rights rwx for everyone and.... no difference, same error:

Code:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, you@example.com and inform them of the time the error occurred, 
and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

K.
 
I think you need a Limit statement around valid-user as well. Replace

Code:
Require valid-user

with

Code:
<Limit GET POST>
Require valid-user
</Limit>
 
Did you restart Apache and check whether the error message in /var/log/httpd-error.log changed?
 
Yes, I restarted. Message in logs still the same.

Code:
# grep AUTH /var/db/ports/apache22/options
WITH_AUTH_BASIC=true
WITHOUT_AUTH_DIGEST=true
WITH_AUTHN_FILE=true
WITHOUT_AUTHN_DBD=true
WITHOUT_AUTHN_DBM=true
WITHOUT_AUTHN_ANON=true
WITHOUT_AUTHN_DEFAULT=true
WITHOUT_AUTHN_ALIAS=true
WITH_AUTHZ_HOST=true
WITHOUT_AUTHZ_GROUPFILE=true
WITHOUT_AUTHZ_USER=true
WITHOUT_AUTHZ_DBM=true
WITHOUT_AUTHZ_OWNER=true
WITHOUT_AUTHZ_DEFAULT=true
WITHOUT_AUTHNZ_LDAP=true

Edit: Any difference in which part of httpd.conf my <Directory> statement is ?

K.
 
You have a lot of 'WITHOUT' settings there, and those are not the default settings of Apache22, which are (for the 'AUTH' part) ->

Code:
WITH_AUTH_BASIC=true
WITH_AUTH_DIGEST=true
WITH_AUTHN_FILE=true
WITHOUT_AUTHN_DBD=true
WITH_AUTHN_DBM=true
WITH_AUTHN_ANON=true
WITH_AUTHN_DEFAULT=true
WITH_AUTHN_ALIAS=true
WITH_AUTHZ_HOST=true
WITH_AUTHZ_GROUPFILE=true
WITH_AUTHZ_USER=true
WITH_AUTHZ_DBM=true
WITH_AUTHZ_OWNER=true
WITH_AUTHZ_DEFAULT=true
WITHOUT_AUTHNZ_LDAP=true

You might want to run [cmd=]make rmconfig[/cmd] in the Apache port and reinstall Apache with default settings for AUTH.
 
Yes, I did that on purpose, because I'm new to apache and figured that I will learn more if I don't have everything 'out of the box'. I had to configure few things so I had to read documentation and figure out what I need and why.. Unfortunately this is the best way for me to learn stuff ;/

Will try that rmconfig tomorow and try to figure out what I might be missing if that will help.

Thanks guys,
K.
 
If you want to learn: start with the defaults, and experiment with variations later. Not the other way around ;)
 
Back
Top