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.
htpasswd -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.
<VirtualHost *:80>
ServerName
DocumentRoot /var/www/websitething/public
<Directory /var/www/websitething/public>
AuthType Basic
AuthName MyPrivateFile
AuthUserFile /var/www/websitething/.htpasswd
Satisfy All
Require valid-user
</Directory>
</VirtualHost>