From 6da190b110700c8f7efd9c26ddef164cc038cde2 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Wed, 13 Jan 2021 09:49:49 +0100 Subject: [PATCH] Don't configure HTTPS site when certs missing --- .../templates/default/nginx_conf_mastodon.erb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/site-cookbooks/kosmos-mastodon/templates/default/nginx_conf_mastodon.erb b/site-cookbooks/kosmos-mastodon/templates/default/nginx_conf_mastodon.erb index 20d2efa..6991f7a 100644 --- a/site-cookbooks/kosmos-mastodon/templates/default/nginx_conf_mastodon.erb +++ b/site-cookbooks/kosmos-mastodon/templates/default/nginx_conf_mastodon.erb @@ -11,17 +11,16 @@ map $http_upgrade $connection_upgrade { '' close; } +<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) %> server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name <%= @server_name %>; include <%= @shared_config_path %>; - <% if File.exist?(@ssl_cert) && - File.exist?(@ssl_key) -%> ssl_certificate <%= @ssl_cert %>; ssl_certificate_key <%= @ssl_key %>; - <% end -%> add_header Strict-Transport-Security "max-age=31536000"; } +<% end %>