server {
        listen   443;
        server_name  citoyen.example.fr;

        ssl                  on;
        ssl_certificate      /etc/ssl/certs/ssl-cert-snakeoil.pem;
        ssl_certificate_key  /etc/ssl/private/ssl-cert-snakeoil.key;

        access_log  /var/log/nginx/citoyen.example.fr-access.log combined;
        error_log  /var/log/nginx/citoyen.example.fr-error.log;

        location /static {
             alias   /var/lib/portail-citoyen/static;
        }

        location / {
            proxy_pass         http://unix:/var/run/portail-citoyen/portail-citoyen.sock;
            proxy_set_header   Host $http_host;
            proxy_set_header   X-Forwarded-SSL on;
            proxy_set_header   X-Forwarded-Protocol ssl;
            proxy_set_header   X-Forwarded-Proto https;
        }
}

server {
        listen   80;
        server_name  citoyen.example.fr;

        access_log  /var/log/nginx/citoyen.example.fr-access.log combined;
        error_log  /var/log/nginx/citoyen.example.fr-error.log;

        location /static {
             alias   /var/lib/portail-citoyen/static;
        }

        location / {
            proxy_pass         http://unix:/var/run/portail-citoyen/portail-citoyen.sock;
            proxy_set_header   Host $http_host;
        }
}

