Appendix D - Open LDAP Setup : Configure the HTTPS Virtual Host File
  

Configure the HTTPS Virtual Host File

Apache includes a default SSL Virtual Host file. However, it is not enabled by default.
We can enable it by typing:
sudo a2ensite default-ssl.conf
 
This will link the file from the sites-available directory into the sites-enabled directory. We can edit this file now by typing:
sudo nano /etc/apache2/sites-enabled/default-ssl.conf
 
This file is a bit more complex than the last one, so we will only discuss the changes that we have to make. All of the changes below should go within the Virtual Host block in the file.
First, set the ServerName value to your server's domain name or IP address again and change the ServerAdmin directive as well:
ServerAdmin webmaster@server_domain_or_IP
ServerName server_domain_or_IP
 
Next, we need to set the SSL certificate directives to point to the key and certificate that we created. The directives should already exist in your file, so just modify the files they point to:
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
 
The last thing we need to do is set up the location block that will implement our password protection for the entire phpLDAPadmin installation.
We do this by referencing the location where we are serving the phpLDAPadmin and setting up authentication using the file we generated. We will require anyone attempting to access this content to authenticate as a valid user:
<Location /superldap>
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/apache2/htpasswd
Require valid-user
</Location>
 
Save and close the file when you are finished.
Restart Apache to implement all of the changes that we have made:
sudo service apache2 restart
 
We can now move on to the actual interface.