Generally, I update web pages over ssh session. The problem is that vim creates a backup files ended with a diacritical mark (~).
Some other open source software use .inc extensions of php and other include for code. However, lighttpd comes with nifty module called mod_access module which is used to deny access to files with given trailing path names.
Open lighty’s config file:
# vi /etc/lighttpd/lighttpd.conf
Append or add mod_access (if it is not added) :
server.modules += ( "mod_access" )
Next append rule that deny access to files with given trailing path names (~ and .inc):
url.access-deny = ( "~", ".inc" )
Save and close the file. Restart lighttpd:
# /etc/init.d/lighttpd restart
Now if end users try to open .inc or other trailing path names he/she will get error 404.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 6 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Just helped me. Thanks a ton.
This worked for me :
$HTTP[“url”] =~ “/.†{
url.access-deny = ( Ҡ)
}
How do I deny files starting with a certain expression (e.g. dotfiles) ?
This worked for me :
$HTTP[“url”] =~ “/.†{
url.access-deny = ( Ҡ)
}
If you want to block access to an entire directory and its sub directories you can do
$HTTP[“url”] =~ “^/directorynamehere/” {
url.access-deny = ( “” )
}
Hey thanks dude
this tutorial really helps me a lot.