diff --git a/roles/wsgi_website/templates/nginx_site.j2 b/roles/wsgi_website/templates/nginx_site.j2 index 361af0e1a948200036a994b49f3f290c9622134f..e47a06cf35d45d6621f3052d92e5a2e5f087acb2 100644 --- a/roles/wsgi_website/templates/nginx_site.j2 +++ b/roles/wsgi_website/templates/nginx_site.j2 @@ -1,4 +1,3 @@ -{% if enforce_https -%} server { # HTTP (plaintext) configuration. listen 80; @@ -8,28 +7,20 @@ server { return 301 https://$host$request_uri; } -{% endif -%} server { # Base settings. root {{ home }}/htdocs/; server_name {{ fqdn }}; -{% if not enforce_https %} - # HTTP (plaintext) configuration. - listen 80; - -{% endif %} # HTTPS (TLS) configuration. listen 443 ssl; listen [::]:443 ssl; ssl_certificate_key /etc/ssl/private/{{ fqdn }}_https.key; ssl_certificate /etc/ssl/certs/{{ fqdn }}_https.pem; -{% if enforce_https -%} # Set-up HSTS header for preventing downgrades for users that visited the # site via HTTPS at least once. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains"; -{% endif -%} {% for config in additional_nginx_config -%} # {{ config.comment }}