วันอังคารที่ 4 มกราคม พ.ศ. 2554

protecting web access with mod_auth

You can limit web access by password. Apache has module mod_auth* for you. It's easy.



1. create password file
# htpasswd -c /usr/local/apache/passwd/passwords rbowen
New password: mypassword
Re-type new password: mypassword
Adding password for user rbowen

for additional user just remove "-c"

2. add directive to apache (.httaccess or )
AuthType Basic
AuthName "Restricted Files"
# (Following line optional)
AuthBasicProvider file
AuthUserFile /usr/local/apache/passwd/passwords
Require user rbowen

3. Restart apache and have fun!
If you have a problem, please investigate the error_log first.


More information :