Appendix D - Open LDAP Setup : Configure the HTTP Virtual Host
  

Configure the HTTP Virtual Host

Next, we need to modify our current Virtual Hosts file. Open it with root privileges in your editor:
sudo nano /etc/apache2/sites-enabled/000-default.conf
 
Inside, you will see a rather bare configuration file that looks like this:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
 
We want to add information about our domain name or IP address to define our server name and we want to set up our redirect to point all HTTP requests to the HTTPS interface. This will match the alias we configured in the last section.
The changes we discussed will end up looking like this. Modify with your own values:
<VirtualHost *:80>
ServerAdmin webmaster@server_domain_or_IP
DocumentRoot /var/www/html
ServerName server_domain_or_IP
Redirect permanent /superldap https://server_domain_or_IP/superldap
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
 
Save and close the file when you are finished.