server { listen 443; server_name authentic.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/authentic.example.fr-access.log combined; error_log /var/log/nginx/authentic.example.fr-error.log; location /static { alias /var/lib/authentic2/static; } location / { proxy_pass http://unix:/var/run/authentic2/authentic2.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 authentic.example.fr; access_log /var/log/nginx/authentic.example.fr-access.log combined; error_log /var/log/nginx/authentic.example.fr-error.log; location /static { alias /var/lib/authentic2/static; } location / { proxy_pass http://unix:/var/run/authentic2/authentic2.sock; proxy_set_header Host $http_host; } }