In .htaccess:
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /the/location/of/.htpasswd (or /the/location/of/whatever/pass/file)
Require user the_username
In vhost:
<VirtualHost *:80>
ServerName www.example.com
ServerAdmin webmaster@example.com
DocumentRoot /var/www/example
...
<Directory /var/www/example>
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /the/location/of/.htpasswd (or /the/location/of/whatever/pass/file)
Require user the_username
</Directory>
</VirtualHost>