The mod_access module is used to deny access to files and directories. Edit /etc/lighttpd/lighttpd.conf file as follows:
# vi lighttpd.conf
Add the following code to enable mod_access:
server.modules += ( "mod_access" )
Finally add regex as follows:
Save and close the file. Restart the lighttpd web server (first, check for syntax error):
# deny access to /dir1
$HTTP["url"] =~ "^/dir1/" {
url.access-deny = ("")
}
# deny access to /dir2/cache/
$HTTP["url"] =~ "^/dir2/cache/" {
url.access-deny = ("")
}
# add other config below
# lighttpd -t -f /etc/lighttpd/lighttpd.conf
# service lighttpd restart
See also:
- Lighttpd restrict or deny access by IP address
No comments:
Post a Comment