From 4de7e5398cbd9ddd363a7364e45029e5f69f1f46 Mon Sep 17 00:00:00 2001 From: Marcel Hofer <3976393+mhofer117@users.noreply.github.com> Date: Sun, 20 Oct 2019 20:01:28 +0200 Subject: [PATCH] Fix sample redirect docs Fix acme challenge and duplicate hostnames in sample config. Create new file instead of changing the site.conf --- docs/u_e-80_to_443.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/u_e-80_to_443.md b/docs/u_e-80_to_443.md index d670c1b61..f288912b7 100644 --- a/docs/u_e-80_to_443.md +++ b/docs/u_e-80_to_443.md @@ -4,15 +4,22 @@ Since February the 28th 2017 mailcow does come with port 80 and 443 enabled. Open `mailcow.conf` and set `HTTP_BIND=0.0.0.0` - if not already set. -Open `data/conf/nginx/site.conf` and add the new server config at the top of that file: +Create a new file `data/conf/nginx/redirect.conf` and add the following server config to the file: ``` server { + root /web; listen 80 default_server; listen [::]:80 default_server; - include /etc/nginx/conf.d/server_name.active; + server_name _; if ( $request_uri ~* "%0A|%0D" ) { return 403; } - return 301 https://$host$uri$is_args$args; + location ^~ /.well-known/acme-challenge/ { + allow all; + default_type "text/plain"; + } + location / { + return 301 https://$host$uri$is_args$args; + } } ```