mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-26 02:57:04 +00:00
95173bb327
* Split the nginx templates again so we have just the part needed to make a domain do a redirect separate from the rest. * Add server blocks to the nginx config for these domains. * List these domains in the SSL certificate install admin panel. * Generate default 'www' records just for domains we provide default redirects for. Fixes #321.
38 lines
833 B
Nginx Configuration File
38 lines
833 B
Nginx Configuration File
## $HOSTNAME
|
|
|
|
# Redirect all HTTP to HTTPS.
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
|
|
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;
|
|
|
|
# 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;
|
|
}
|
|
|
|
# The secure HTTPS server.
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
|
|
server_name $HOSTNAME;
|
|
|
|
# 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;
|
|
include /etc/nginx/nginx-ssl.conf;
|
|
|
|
# ADDITIONAL DIRECTIVES HERE
|
|
}
|