mailcow-dockerized-docs/docs/u_e-80_to_443.md

45 Zeilen
1,2 KiB
Markdown

2017-05-06 00:22:26 +02:00
Since February the 28th 2017 mailcow does come with port 80 and 443 enabled.
2018-10-16 12:09:35 +02:00
**Do not use the config below for reverse proxy setups**, please see our reverse proxy guide for this, which includes a redirect from HTTP to HTTPS.
2017-05-06 00:22:26 +02:00
Open `mailcow.conf` and set `HTTP_BIND=0.0.0.0` - if not already set.
2018-10-16 12:09:35 +02:00
Now we need to redirect all requests other than autoconfig.* to HTTPS. You do not need to change anything in the template below.
Open `data/conf/nginx/site.conf` and add two new server configs at the top of that file:
2017-05-06 00:22:26 +02:00
```
2018-10-16 12:09:35 +02:00
server {
listen 80;
listen [::]:80;
server_name autoconfig.*;
root /web;
location / {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass phpfpm:9002;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/autoconfig.php;
try_files /autoconfig.php =404;
}
}
2017-05-06 00:22:26 +02:00
server {
listen 80 default_server;
listen [::]:80 default_server;
include /etc/nginx/conf.d/server_name.active;
2018-12-27 19:05:22 +01:00
if ( $request_uri ~* "%0A|%0D" ) { return 403; }
return 301 https://$host$uri$is_args$args;
2017-05-06 00:22:26 +02:00
}
```
In case you changed the HTTP_BIND parameter, recreate the container:
```
docker-compose up -d
```
Otherwise restart Nginx:
```
docker-compose restart nginx-mailcow
```