Basic Authentication For Apache
Goal, make the directory /spot/ require a user name and password, using the simplist possible method.
ok first make sure you have the mods, auth_digest, I'm using debian so its here
ls -l /etc/apache2/mods-available/auth_digest.load
Now make sure its linked in, again with debain this just requires a soft link, other distros will need to make conf changes to their http.conf
ln -s /etc/apache2/mods-available/auth_digest.load /etc/apache2/mods-enabled/auth_digest.load
Now we need to change the directory settings
Alias "/spot/" /my/special/spot
<Directory /my/special/spot >
AuthType digest
AuthName personal_info
AuthDigestFile /etc/apache2/digest/personal_info
Require user friend family
</Directory>
You can see I've specified a file, we'll need to go make that. The "-c" option creates the file.
sudo mkdir /etc/apach2/digest/ htpasswd2 -c /etc/apache2/digest/personal_info friend htpasswd2 /etc/apache2/digest/personal_info family
Now restart
sudo /usr/sbin/apache2ctl graceful
all done test it out!
now restart and it should work