Basic HTTP Auth

To protect a site behind basic HTTP Authentication

Using vhosts

<Directory "/var/www/[path_to_site]">
    AllowOverride All
</Directory>
<Location />
    AuthType Basic
    AuthUserFile /srv/auth/.htpasswd
    AuthName "Enter details to log in"
    Require valid-user
  </Location>

Then create the /srv/auth/.htpasswd file which stores the user/password combo:

htpasswd -c /srv/auth/.htpasswd [user_name]

Enter your password and it's saved. Restart apache to complete the process.

If you have an existing file, omit the -c option. The -b option allows you to enter the password as the last parameter of the command, as in this example :

htpasswd -b /srv/auth/.htpasswd username pa55w0rd

See Linode Docs for more details.