Adding Basic Authentication to Drupal

For my own future refrerence, and for those who wish to develop similar projects, here's how I added the authentication. Students can ignore the contents of this box.
sudo cp /etc/apache2/sites-available/drupal.conf /etc/apache2/sites-available/drupal.conf.orig
sudo nano /etc/apache2/sites-available/drupal.conf
Replace the contents with this:
<VirtualHost *:80>
     DocumentRoot /var/www/html/drupal

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

      <Directory /var/www/html/drupal/>
		AuthType Basic
		AuthName "Private"
		AuthUserFile /etc/apache2/.htaccess
		Require valid-user
		AllowOverride None
		Order allow,deny
		allow from all
		Options FollowSymlinks

      <Directory /var/www/html/drupal>
            RewriteEngine on
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Save the file.
sudo htpasswd -c /etc/apache2/.htaccess student1
Enter the password student1 twice.
sudo service apache2 restart