RobL Vs

Background

htpasswd files and basic Apache authetication

Its been a long time since I needed to do any kind of basic Apache authetication so a quick reminder to myself more than anything.

Its easy to generate a new file with the username and password. Don’t use ‘-c’ the next time as you’ll lose the contents of your original file.

1htpasswd -b -c /var/www/websitething/.htpasswd username password

Adding this to my basic VirtualHost config now restricts access to the site with my username/password. woo.

 1<VirtualHost *:80>
 2  ServerName
 3  DocumentRoot /var/www/websitething/public
 4
 5  <Directory /var/www/websitething/public>
 6    AuthType Basic
 7    AuthName MyPrivateFile
 8    AuthUserFile /var/www/websitething/.htpasswd
 9    Satisfy All
10    Require valid-user
11  </Directory>
12
13</VirtualHost>