Aller au contenu
Infogérance Linux Debian en France

Infogérance Linux Debian en France

Kogitae : Ingéniérie de l'hébergement Internet

  • Accueil
  • Parcours
  • Presse
  • Portfolio
  • Blog

2skies.com :: basic http authentication with lighttpd

  • Accueil » Blog » 2skies.com :: basic http authentication with lighttpd
DansHebergement, Lighttpd

2skies.com :: basic http authentication with lighttpd

Password protection can limit access to your website or a specific sub-directory.

lighttpd.conf

Make sure you enable mod_access and mod_auth in your lighttpd.conf:

server.modules += ( « mod_access » )

server.modules += ( « mod_auth » )

htpasswd

#htpasswd -c ~/lighttpd/foo-auth.xt username

Running this command will prompt for this user’s new password to store in the txt file. Combining this with a special $HTTP[« host »] conditional ruleset in our lighttpd.conf will allow us to enable BASIC http authentication.

$HTTP[« host »] =~ « .*domainroot.* » {

$HTTP[« url »] =~ « ^/somesubdir/ » {

auth.backend = « htpasswd »

auth.backend.htpasswd.userfile = « /home/you/lighttpd/foo-auth.txt »

auth.require = (« /somesubdir » => (

« method » => « basic »,

« realm » => « anything »,

« require » => « valid-user »

))

}

}

Plain Text

If you don’t have access to htpasswd or don’t care if the password is not encrypted, you can simply create a plain text file with the following:

username:123

« Username » can be any user name you like and the « 123 » is the password.

The configuration is a little different for this form of authentication:

$HTTP[« url »] =~ « ^/somesubdir » {

auth.backend = « plain »

auth.backend.plain.userfile = « /home/you/lighttpd/foo-auth.txt »

auth.require = (« /somesubdir » => (

« method » => « basic »,

« realm » => « whatever »,

« require » => « valid-user »

))

}

via2skies.com :: basic http authentication with lighttpd.

administrateur-system-infogerance administrateur-systeme-et-reseau-freelance administrateur-systeme-infogerance administrateur-systeme-linux-freelance auth auth-backend-htpasswd-userfile basic-lighttpd blog-administration-systeme freelance-infogerance htpasswd kogitae kogitae-fr le-blog-dun-admin-systeme lighttpd lighttpd-auth-basic-not-working lighttpd-authentication lighttpd-hebergement lighttpd-htpasswd lighttpd-mod_auth protect-subdirectory-lighttpd

Étiquettes

administrateur-systeme-freelance (9) amazon (3) apache (14) asterisk (9) auth (3) bash (6) blog-administrateur-systeme (14) blog-administration-systeme (4) collectd (5) cpu (3) debian (30) dovecot (4) duplicate (3) f (6) freelance-asterisk (3) google (3) infogerance-linux (5) infogérance (4) ipv6 (7) kernel (4) kogitae (30) kogitae-com (3) kogitae-fr (6) lamp-or-linux-or-developpement-web-and-apache-or-php-or-mysql-or-adobe-or-eclipse-or-zend-or-mozilla-or-firefox (17) lenny (4) lighttpd (5) limit (4) linux (26) mail (7) mdadm (6) mysql (14) openvz (9) optimiser (4) php (5) postfix (11) privvmpages-openvz (3) pxe (3) raid (3) SEO (5) ssh (8) ssl (3) test (3) voip (4) wordpress (6) www-kogitae-fr (7)