Chapter 2. Setting up the virtual server

The first thing to do is getting the Apache server to listen to port 443 as well as port 80. This is done in the main configuration file /etc/apache/httpd.conf, where we add the Port directive for port 443.


Port 80
Port 443

next we setup a virtual server to take care of the admin site.

In the /etc/apache/vhosts.conf file, we add the following:


NameVirtualHost 192.168.228.14:443
NameVirtualHost 62.242.188.206:443

<VirtualHost 62.242.188.206:443 192.168.228.14:443>
	ServerAdmin  www@hoejte.dk
	ServerName   admin.hoejte.dk
	ServerAlias  www.admin.hoejte.dk
	ErrorLog     /var/log/apache/admin/error.log
	TransferLog  /var/log/apache/admin/access.log
	DocumentRoot /home/www/admin/html
	php_admin_value safe_mode Off
	SSLEngine on
	SSLCertificateFile    /home/www/admin/ssl/admin.crt
	SSLCertificateKeyFile /home/www/admin/ssl/admin.key
</VirtualHost>

This virtual server will only respond to requests on port 443 (https), which is what we want. No unencrypted access to this beast. Vi added the NameVirtualHost directive for port 443 as well, since we would otherwise not be able to listen to this port.

Ths server should new be setup in apache, but will however generate an error due to the fact that we have yet to install the SSL certificate necessary to encrypt the connection, and the apache server itself does not yet know about ssl.