username
./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.sudo htpasswd /etc/apache2/.htpasswd username
. Replace username
with the user name you wish. The program will ask for a password.sudo service apache2 restart
.