Mailcow Nginx Proxy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.8 KiB

server {
listen 80;
listen [::]:80;
server_name example.com www.example.com mail.example.com autodiscover.* autoconfig.*;
if ($host = autoconfig.example.com) {
return 301 https://$host$request_uri;
}
if ($host = autodiscover.example.com) {
return 301 https://$host$request_uri;
}
if ($host = mail.example.com) {
return 301 https://$host$request_uri;
}
if ($host = www.example.com) {
return 301 https://$host$request_uri;
}
if ($host = example.com) {
return 301 https://$host$request_uri;
} # Edit the cli.ini in /etc/letsencrypt/ directory to add security enchancements
return 404;
}
server {
listen 443 ssl;
listen [::]:443 ssl ipv6only=on;
server_name www.example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
include /etc/nginx/snippets/ssl.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
include /etc/nginx/snippets/stapling.conf;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl ipv6only=on;
server_name example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
include /etc/nginx/snippets/ssl.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
include /etc/nginx/snippets/stapling.conf;
include /etc/nginx/snippets/security.conf;
root /var/www/example.com/public;
index index.html index.htm;
}