# Fichier de configuration pour Apache 2.4


WSGIDaemonProcess __SERVERNAME__ python-path=/srv/__SERVERNAME__ user=www-data group=www-data

WSGIProcessGroup __SERVERNAME__

<VirtualHost *:80>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
    ServerName __SERVERNAME__

    ServerAdmin webmaster@localhost
    DocumentRoot /srv/__SERVERNAME__

    RewriteEngine on
    RewriteCond %{SERVER_NAME} =__SERVERNAME__
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot "/srv/__SERVERNAME__"
    ServerName __SERVERNAME__

    Alias /static/ /srv/__SERVERNAME__/static/
    <Directory /srv/__SERVERNAME__/static>
	Require all granted
    </Directory>

    Alias /media/ /srv/__SERVERNAME__/media/
    <Directory /srv/__SERVERNAME__/media>
	Require all granted
    </Directory>

    WSGIScriptAlias / /srv/__SERVERNAME__/manuels/wsgi.py process-group=__SERVERNAME__ application-group=%{GLOBAL}

     <Directory /srv/__SERVERNAME__/manuels>
	<Files wsgi.py>
	    Require all granted
	</Files>
    </Directory>
    SSLEngine on
    SSLCertificateFile	/etc/letsencrypt/live/__SERVERNAME__/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/__SERVERNAME__/privkey.pem
</VirtualHost>
