<VirtualHost *:80>
    ServerName {{ matrix_subdomain }}.{{ item.name }}

    Redirect temp / https://{{ matrix_subdomain }}.{{ item.name }}/
</VirtualHost>

<VirtualHost *:443>
    ServerName {{ matrix_subdomain }}.{{ item.name }}

    SSLEngine               On
    DocumentRoot            "/var/www/riot"
    DirectoryIndex          index.html
    Options                 -Indexes
    HostnameLookups         Off
    LogLevel                warn
    ErrorLog                /var/log/apache2/matrix.info-error_log
    CustomLog               /var/log/apache2/matrix.info-access_log common

    ProxyRequests           Off
    ProxyPreserveHost       On
    ProxyPass               /_matrix http://localhost:8008/_matrix nocanon
    ProxyPassReverse        /_matrix http://localhost:8008/_matrix
</VirtualHost>