Simplest way to implement directory level authorization on Apache HTTP server is to use .htaccess file with password file combinations, You will find How to Implement Authorization on Apache everywhere. But there are couple of things which you will not find in these sites, because they assume that you would have done this before or you know about this already. So let me run thru basic steps and steps which are generally ignored (but very important get this out there)
- Create .htaccess file with all the directives like AuthType,AuthName,AuthUserFile,Require attributes
- Create password file (as specified in AuthUserFile) using htpasswd command.
- LoadModule auth_module libexec/httpd/mod_auth.so
- AddModule mod_auth.c
Deny from all
- Most important step which makes or brakes this whole exercise
- "AllowOverride none" should be replaced by "AllowOverride AuthConfig"
With above you should be up and running with Apache Basic Auth.