mailinabox/conf/nginx.conf

50 lines
1.3 KiB
Nginx Configuration File
Raw Normal View History

## $HOSTNAME
2019-02-10 21:39:38 +00:00
#BEGIN_HTTP
# Redirect all HTTP to HTTPS *except* the ACME challenges (Let's Encrypt TLS certificate
# domain validation challenges) path, which must be served over HTTP per the ACME spec
# (due to some Apache vulnerability).
2013-09-01 14:24:49 +00:00
server {
listen 80;
listen [::]:80;
2013-09-01 14:24:49 +00:00
server_name $HOSTNAME;
root /tmp/invalid-path-nothing-here;
# Improve privacy: Hide version an OS information on
# error pages and in the "Server" HTTP-Header.
server_tokens off;
location / {
# Redirect using the 'return' directive and the built-in
# variable '$request_uri' to avoid any capturing, matching
# or evaluation of regular expressions.
return 301 https://$HOSTNAME$request_uri;
}
location /.well-known/acme-challenge/ {
# This path must be served over HTTP for ACME domain validation.
# We map this to a special path where our TLS cert provisioning
# tool knows to store challenge response files.
alias $STORAGE_ROOT/ssl/lets_encrypt/webroot/.well-known/acme-challenge/;
}
2013-09-07 20:53:25 +00:00
}
2019-02-10 21:39:38 +00:00
#END_HTTP
2013-09-07 20:53:25 +00:00
# The secure HTTPS server.
server {
2019-02-10 21:39:38 +00:00
listen $HTTP_SSL_PORT ssl http2;
listen [::]:$HTTP_SSL_PORT ssl http2;
2013-09-01 14:24:49 +00:00
server_name $HOSTNAME;
2013-09-07 20:53:25 +00:00
# Improve privacy: Hide version an OS information on
# error pages and in the "Server" HTTP-Header.
server_tokens off;
ssl_certificate $SSL_CERTIFICATE;
ssl_certificate_key $SSL_KEY;
# ADDITIONAL DIRECTIVES HERE
2013-09-01 14:24:49 +00:00
}