<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerName ouvriersdeuxmondes.huma-num.fr
                ServerAdmin jean-damien.genero@ehess.fr

                # Document root doesn't really matter as it will be overriden
                DocumentRoot /var/www/html

                # WSGI configuration
                # - name the process od2m
                # - run it as dedicated www-od2m user
                WSGIDaemonProcess od2m user=www-od2m group=www-od2m threads=5 python-home=/var/www/od2m/.venv/ locale=en_US.UTF-8 socket-timeout=600
                WSGIScriptAlias / /var/www/od2m/wsgi.py
                <Directory /var/www/od2m>
                        WSGIProcessGroup od2m
                        WSGIApplicationGroup %{GLOBAL}
                        Order deny,allow
                        Allow from all
                </Directory>

                # Log files configuration
                ErrorLog ${APACHE_LOG_DIR}/od2m-error.log
                CustomLog ${APACHE_LOG_DIR}/od2m-access.log combined

                # SSL configuration
                SSLEngine on
                SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>

                Include /etc/letsencrypt/options-ssl-apache.conf
                SSLCertificateFile /etc/letsencrypt/live/ouvriersdeuxmondes.huma-num.fr/fullchain.pem
                SSLCertificateKeyFile /etc/letsencrypt/live/ouvriersdeuxmondes.huma-num.fr/privkey.pem
        </VirtualHost>

        <VirtualHost *:80>
                # Make the HTTP virtual host redirect to HTTPS
                ServerName ouvriersdeuxmondes.huma-num.fr
                Redirect / https://ouvriersdeuxmondes.huma-num.fr
        </VirtualHost>
</IfModule>