Skip to content

Instantly share code, notes, and snippets.

@dginhoux
Forked from MinaMikhailcom/lighttpd.conf
Last active October 29, 2022 11:55
Show Gist options
  • Save dginhoux/231f7012ed5c24a999074d1aa2d83c1c to your computer and use it in GitHub Desktop.
Save dginhoux/231f7012ed5c24a999074d1aa2d83c1c to your computer and use it in GitHub Desktop.
Basic authentication configurations for Lighttpd under Ubuntu
apt install apache2-utils
htpasswd -c /etc/lighttpd/.htpasswd <Username> #Replace <Username>, you will be prompted to enter the password.
# Make sure that "mod_auth" is loaded in "server.modules".
nano /etc/lighttpd/lighttpd.conf
#Add the following to lighttpd.conf.
auth.backend = "htpasswd"
auth.backend.htpasswd.userfile= "/etc/lighttpd/.htpasswd"
auth.require = ( "/RestrictedURL" =>
(
"method" => "basic",
"realm" => "Restricted!",
"require" => "valid-user"
),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment