<VirtualHost *:80>
    ServerName {{ evoadminmail_host }}
    Redirect permanent / https://{{ evoadminmail_host }}/
</VirtualHost>

<VirtualHost *:443>

    # FQDN principal
    ServerName {{ evoadminmail_host }}
    #ServerAlias {{ evoadminmail_host }}

    # Repertoire principal
    DocumentRoot /usr/share/evoadmin-mail/

    # SSL
    SSLEngine on
    SSLCertificateFile    /etc/ssl/certs/{{ evoadminmail_host }}.crt
    SSLCertificateKeyFile /etc/ssl/private/{{ evoadminmail_host }}.key
    SSLProtocol all -SSLv2 -SSLv3

    # Propriete du repertoire
    <Directory /usr/share/evoadmin-mail/>
        #Options Indexes SymLinksIfOwnerMatch
        Options SymLinksIfOwnerMatch
        AllowOverride AuthConfig Limit FileInfo Indexes
        Require all granted
    </Directory>

    # user - group (thanks to sesse@debian.org)
    AssignUserID evoadmin-mail evoadmin-mail

    # LOG
    CustomLog /var/log/apache2/access.log combined
    ErrorLog  /var/log/apache2/error.log

    # AWSTATS
    SetEnv AWSTATS_FORCE_CONFIG evoadmin-mail
    SetEnv EVOADMINMAIL_CONFIG_FILE /etc/evoadmin-mail/config.ini

    # REWRITE
    UseCanonicalName On
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^{{ evoadminmail_host }}$
    RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]

    # PHP
    #php_admin_flag engine off
    #AddType text/html .html
    #php_admin_flag display_errors On
    #php_flag short_open_tag On
    #php_flag register_globals On
    #php_admin_value memory_limit 256M
    #php_admin_value max_execution_time 60
    #php_admin_value upload_max_filesize 8M
    #php_admin_flag allow_url_fopen Off
    php_admin_value open_basedir "none"
</VirtualHost>
