Steps to Adding Documents

  1. Create a sub-directory in the appropriate server directory named username.
  2. Alter the virtual host file (in /etc/apache2/sites-enabled/) to add
    <Directory "/var/www/site/username">
      AuthType Basic
      AuthName "Choose a name"
      AuthUserFile /etc/apache2/.htpasswd
      Require user ebaum username
    </Directory>
    
    within the VirtualHost. Replace site and username in the directory specification with desired values. Note that username appears twice: once to specify the directory and once to allow a user to access it.
  3. Add the user to the password file by running sudo htpasswd /etc/apache2/.htpasswd username. Replace username with the user name you wish. The program will ask for a password.
  4. Restart Apache with sudo service apache2 restart.
  5. Add the protected documents to the directory.