All these are working on Ubuntu 13.04
1. Check if apache modules are loaded:
on ubuntu this one works find:
not all required, but my config is loading these now. auth_... and authn_... are realy required for my example, but i don't know which of those authz are required..
2. Make password file.
Be sure, that it is NOT in the PUBLIC path! DO NOT add it to your public_html or similar folder. It's unsafe.
htpasswd -c /var/srv/.htpasswd USERNAME
after this command you will have to enter password twice and your file will be ready to go. Make sure, that chmod is OK. While testing (after finnishing all steps) try to look to error.log (/var/log/apache2/error.log or some other place depends of your config).
3. Make .htaccess file
Just make this file in folder, which should be protected and add these lines:
AuthName "Authentication Required"
If your settings are not working, maybe you don't have rights to make changes to Apache config? try adding this to your virtualhost:
5. Reload/restart apache!
service apache2 restart