Thursday, January 31, 2008

enable password protected lighttpd folders

1. open /etc/lighttpd/lighttpd.conf
2. add "mod_auth to server.modules"
3. add this block of code right after. replace items in <> with desired value


auth.debug = 2
auth.backend = "plain"
auth.backend.plain.userfile = "/home/<username>/.lighttpdpassword"

auth.require = ( "/<web accessible domain to protect>/" =>
(
"method" => "basic",
"realm" => "Password protected area",
"require" => "user=<username>"
)


4. save configuration
5. create the password file ".lighttpdpassword" and append usernames and passwords

<username>:<password>
...

6. save and allow access to everyone chmod 777 .lighttpdpassword
7. restart lighthttpd with /etc/init.d/lighttpd restart

No comments: