mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-22 02:17:26 +00:00
redirect all HTTP to HTTPS and enable HSTS, closes #18
This commit is contained in:
parent
091a58ac94
commit
b646771517
@ -7,7 +7,7 @@
|
|||||||
#ssl_certificate_key /path/to/my-private-decrypted.key;
|
#ssl_certificate_key /path/to/my-private-decrypted.key;
|
||||||
|
|
||||||
# optional: tell browsers to require SSL (warning: difficult to change your mind)
|
# optional: tell browsers to require SSL (warning: difficult to change your mind)
|
||||||
#add_header Strict-Transport-Security max-age=31536000;
|
add_header Strict-Transport-Security max-age=31536000;
|
||||||
|
|
||||||
# optional: prefer certain ciphersuites, to enforce Perfect Forward Secrecy and avoid known vulnerabilities.
|
# optional: prefer certain ciphersuites, to enforce Perfect Forward Secrecy and avoid known vulnerabilities.
|
||||||
# done in consultation with:
|
# done in consultation with:
|
||||||
@ -43,4 +43,4 @@ spdy_headers_comp 6;
|
|||||||
ssl_stapling on;
|
ssl_stapling on;
|
||||||
ssl_stapling_verify on;
|
ssl_stapling_verify on;
|
||||||
resolver 8.8.8.8;
|
resolver 8.8.8.8;
|
||||||
#ssl_trusted_certificate /path/to/all-certs-in-chain.crt;
|
#ssl_trusted_certificate /path/to/all-certs-in-chain.crt;
|
||||||
|
@ -1,23 +1,11 @@
|
|||||||
# The HTTP (not SSL) server.
|
# Redirect all HTTP to HTTPS.
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
listen [::]:80 default_server ipv6only=on;
|
listen [::]:80 default_server ipv6only=on;
|
||||||
|
|
||||||
server_name $PUBLIC_HOSTNAME;
|
server_name $PUBLIC_HOSTNAME;
|
||||||
|
root /tmp/invalid-path-nothing-here;
|
||||||
# We'll expose this directory publicly over http.
|
rewrite ^/(.*)$ https://$PUBLIC_HOSTNAME/$1 permanent;
|
||||||
root $STORAGE_ROOT/www/static;
|
|
||||||
|
|
||||||
index index.html index.htm;
|
|
||||||
location / {
|
|
||||||
# First attempt to serve request as file, then
|
|
||||||
# as directory, then fall back to displaying a 404.
|
|
||||||
try_files $uri $uri/ /index.html;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Convenience redirect to https.
|
|
||||||
rewrite ^/mail(/.*)?$ https://$PUBLIC_HOSTNAME/mail$1 permanent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# The secure HTTPS server.
|
# The secure HTTPS server.
|
||||||
@ -31,9 +19,8 @@ server {
|
|||||||
ssl_certificate_key $STORAGE_ROOT/ssl/ssl_private_key.pem;
|
ssl_certificate_key $STORAGE_ROOT/ssl/ssl_private_key.pem;
|
||||||
include /etc/nginx/nginx-ssl.conf;
|
include /etc/nginx/nginx-ssl.conf;
|
||||||
|
|
||||||
# We'll expose the same static directory under https.
|
# Expose this directory as static files.
|
||||||
root $STORAGE_ROOT/www/static;
|
root $STORAGE_ROOT/www/static;
|
||||||
|
|
||||||
index index.html index.htm;
|
index index.html index.htm;
|
||||||
|
|
||||||
# Roundcube Webmail configuration.
|
# Roundcube Webmail configuration.
|
||||||
|
Loading…
Reference in New Issue
Block a user