Turning on Apache Basic Auth causes server connection failure
I am trying to test the basic authentication module of apache httpd web server. For some reason when I turn it on, the browser cannot seem to even connect to the server. Details are below. any help will be appreciated.
OS: Mac OSX
Apache/Mysql
Browser: Safari
I 开发者_JAVA百科have a mysql db "mydb" storing username and password in a table called "login". Password is encrypted using SHA.
I have a directory structure like
/Users/Myname/Sites
/Users/Myname/Sites/Secret
I want to secure the Secret folder.
In the httpd.conf I have the following lines
DBDriver mysql
DBDParams "dbname=mydb user=admin password=myadminpasswd"
DBDMin 4
DBDKeep 8
DBDMax 20
DBDExptime 300
<Directory "/Users/Myname/Sites/Secret">
# core authentication and mod_auth_basic configuration
# for mod_authn_dbd
AuthType Basic
AuthName "My Server"
AuthBasicProvider dbd
# core authorization configuration
Require valid-user
# mod_authn_dbd SQL query to authenticate a user
AuthDBDUserPWQuery "SELECT password FROM login WHERE username = %s"
</Directory>
After this I restart the apache httpd server. I cannot even access http://localhost anymore. It gives the following error: Safari can’t open the page “http://localhost/” because Safari can’t connect to the server “localhost”.
I was hoping to be able to access localhost but not http://localhost/~myname/Secret
Does anyone has any idea as to what went wrong?
I believe I can access the secret folder via http://mysername:mypasswd@localhost/~myname/Secret
Notes: I have made sure that the following is loaded in httpd.conf
mod_authz_user.so
mod_authn_dbd.so
thanks mbh
Please check your apache server logs and see what errors you get when restarting it with the auth turned on
精彩评论