|
|
@ -52,12 +52,24 @@ impl<'a> NginxServer<'a, String> { |
|
|
|
pub fn server_config(domain: &str, content: &str) -> String {
|
|
|
|
format!("server {{
|
|
|
|
listen 80;
|
|
|
|
listen 443 ssl;
|
|
|
|
ssl_certificate /etc/ssl/local_certs/{0}.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/private/{0}.key;
|
|
|
|
server_name {0};
|
|
|
|
include \"snippets/acme-challenge.conf\";
|
|
|
|
|
|
|
|
location / {{
|
|
|
|
# Redirect all HTTP links to the matching HTTPS page
|
|
|
|
return 301 https://$host$request_uri;
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
|
|
|
|
server {{
|
|
|
|
listen 443 ssl http2;
|
|
|
|
server_name {0};
|
|
|
|
include \"snippets/acme-challenge.conf\";
|
|
|
|
|
|
|
|
ssl_certificate /etc/ssl/local_certs/{0}.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/private/{0}.key;
|
|
|
|
add_header Strict-Transport-Security \"max-age=31536000\";
|
|
|
|
|
|
|
|
{1}
|
|
|
|
}}
|
|
|
|
", domain, content)
|
|
|
|