Access control on an Apache webserver can be tricky to setup if you don't do this kind of stuff often.
Here is a little help to get you started with the basics.
First go to the directory on your webserver that you wish to secure with a password.
Then create a file .htaccess which contains:
AuthUserFile /var/www/html/.htpasswd
AuthType Basic
AuthGroupFile /dev/null
AuthName "Identify"
Require user test
Then, generate a password file by executing the command. This will create a file .htpasswd in that same directory.
htpasswd -c .htpasswd test
Now change the owner and group of the file so that only apache can read it.
chown apache:apache .htpasswd
If you take a look at the file right in, the rights and owner should now be :
-rw-r--r-- 1 root root 114 Jul 28 12:29 .htaccess
-rw------- 1 apache apache 19 Jul 28 12:35 .htpasswd
Next step is to edit the httpd.conf file in /etc/httpd/conf/. If you use Apache2 it could also be in /etc/apache/
Basically, you need to find the settings for you website here. If you are using only the default website, then you need to edit the global directive of /var/www/html or /var/www depending on your version and distribution. When you found it, change the setting AllowOverride to:
AllowOverride All
so that the webserver will allow your .htaccess and .htpasswd files to override the default settings.