HTTP authentication (snippet)

And the reason for that faff is to start using this blog more to keep track of snippets of code and config that I’m constantly re-using. That is, the things you have half inside your head anyway, but need to look up exactly what the command is.

One from today: setting up basic HTTP Authentication with Apache:

vps:/etc/apache2/sites-enabled# htpasswd -c /etc/apache2/anaad.passwd admin
New password:
Re-type new password:
Adding password for user admin

edit .htaccess:

AuthType Basic
AuthName "Anaad"
AuthUserFile /etc/apache2/anaad.password
Require valid-user

Leave a Reply

Your email address will not be published. Required fields are marked *