Howto: Configure Additonal Websites on UCS

How to configure additional websites in UCS

You want to offer additional websites (or vhosts, VirtualHost)

Solution

Step 1

Create a correct configuration file according to the Apache documentation.
As an example for secured https:// this might look as follows:

<VirtualHost *:443>
    SSLEngine on
    ServerName ucs-local.example.com
    SSLCertificateFile /etc/univention/ssl/ucs-local.example.com/cert.pem
    SSLCertificateKeyFile /etc/univention/ssl/ucs-local.example.com/private.key
    SSLCACertificateFile /etc/univention/ssl/ucsCA/CAcert.pem
</VirtualHost>

Step 2

Place this file into the directory /etc/apache2/site-available and name it to end with “.conf” (ie “mywebsite.conf”).

Step 3

Verify the syntax validity of the files:

root@ucs:/etc/apache2# apache2ctl -t
Syntax OK

Step 4

Enable the site with
a2ensite mywebsite

Step 5

Verify new configuration file is read properly. Your site should appear in the output:

root@ucs:/etc/apache2# apache2ctl -t -D DUMP_INCLUDES| grep sites-enabled
    (225) /etc/apache2/sites-enabled/000-default.conf
[...]
    (19) /etc/apache2/sites-enabled/mywebsite.conf

Step 6

Restart apache to activate your site:
systemctl reload apache2