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

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

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

    SSLEngine               On
    DocumentRoot            "{{ item.doc_root }}"
    DirectoryIndex          index.html
    Options                 -Indexes
    HostnameLookups         Off
    LogLevel                warn
    ErrorLog                /var/log/apache2/fathom.info-error_log
    CustomLog               /var/log/apache2/fathom.info-access_log common

    ProxyRequests           On
    ProxyPreserveHost       On
    ProxyPass               / http://localhost:{{ fathom_internal_port }}/
    ProxyPassReverse        / http://localhost:{{ fathom_internal_port }}/
</VirtualHost>