HTTP->HTTPS, HTTP2, HSTS
This commit is contained in:
parent
2481ac9f70
commit
b3c689eddb
1 changed files with 15 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue