1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2024-12-16 10:59:39 +02:00
mailcow-dockerized/data/conf/nginx/site.conf

211 lines
6.5 KiB
Plaintext
Raw Normal View History

server_tokens off;
proxy_cache_path /tmp levels=1:2 keys_zone=sogo:10m inactive=24h max_size=1g;
server_names_hash_bucket_size 64;
2017-05-03 22:26:10 +02:00
map $http_x_forwarded_proto $client_req_scheme {
default $scheme;
https https;
}
2017-10-12 08:37:48 +02:00
server {
include /etc/nginx/mime.types;
charset utf-8;
override_charset on;
2016-12-22 13:20:26 +02:00
ssl_certificate /etc/ssl/mail/cert.pem;
ssl_certificate_key /etc/ssl/mail/key.pem;
ssl_protocols TLSv1.2 TLSv1.3;
2017-09-14 13:34:07 +02:00
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
2016-12-22 13:20:26 +02:00
ssl_prefer_server_ciphers on;
2017-09-14 13:34:07 +02:00
ssl_session_cache shared:SSL:50m;
ssl_session_timeout 1d;
ssl_session_tickets off;
add_header Strict-Transport-Security "max-age=15768000;";
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
2018-05-28 12:28:23 +02:00
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies none;
2018-08-06 09:24:34 +02:00
add_header Referrer-Policy strict-origin;
2017-09-11 17:37:25 +02:00
2016-12-22 13:20:26 +02:00
index index.php index.html;
2016-12-09 21:39:02 +02:00
2018-08-05 22:37:07 +02:00
client_max_body_size 0;
include /etc/nginx/conf.d/listen_plain.active;
include /etc/nginx/conf.d/listen_ssl.active;
2017-02-28 11:12:18 +02:00
include /etc/nginx/conf.d/server_name.active;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied off;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
location ~ ^/(fonts|js|css|img)/ {
expires max;
add_header Cache-Control public;
}
2017-02-28 11:02:02 +02:00
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
absolute_redirect off;
2017-02-28 11:02:02 +02:00
root /web;
location / {
try_files $uri $uri/ @strip-ext;
}
location /qhandler {
rewrite ^/qhandler/(.*)/(.*) /qhandler.php?action=$1&hash=$2;
}
location /edit {
rewrite ^/edit/(.*)/(.*) /edit.php?$1=$2;
}
location @strip-ext {
rewrite ^(.*)$ $1.php last;
}
2017-04-29 16:36:41 +02:00
location ~ ^/api/v1/(.*)$ {
try_files $uri $uri/ /json_api.php?query=$1;
2017-03-28 11:51:31 +02:00
}
location ^~ /.well-known/acme-challenge/ {
2017-06-14 23:10:50 +02:00
allow all;
default_type "text/plain";
}
2017-02-28 11:02:02 +02:00
# If behind reverse proxy, forwards the correct IP
set_real_ip_from 10.0.0.0/8;
set_real_ip_from 172.16.0.0/12;
set_real_ip_from 192.168.0.0/16;
set_real_ip_from fc00::/7;
2017-02-28 11:02:02 +02:00
real_ip_header X-Forwarded-For;
real_ip_recursive on;
2017-06-14 23:14:41 +02:00
rewrite ^/.well-known/caldav$ /SOGo/dav/ permanent;
2017-06-14 23:17:31 +02:00
rewrite ^/.well-known/carddav$ /SOGo/dav/ permanent;
2017-06-14 23:14:41 +02:00
2017-06-14 23:10:50 +02:00
location ^~ /principals {
return 301 /SOGo/dav;
2017-02-28 11:02:02 +02:00
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass phpfpm:9002;
2017-02-28 11:02:02 +02:00
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_read_timeout 1200;
}
location /rspamd/ {
2018-01-21 15:59:45 +02:00
proxy_pass http://rspamd:11334/;
proxy_set_header Host $http_host;
2017-02-28 11:02:02 +02:00
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;
2017-02-28 11:02:02 +02:00
}
2017-06-15 23:03:10 +02:00
location ~* ^/Autodiscover/Autodiscover.xml {
2017-05-03 22:26:10 +02:00
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass phpfpm:9002;
2017-05-03 22:26:10 +02:00
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
try_files /autodiscover.php =404;
2017-02-28 11:02:02 +02:00
}
location ~* ^/Autodiscover/Autodiscover.json {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass phpfpm:9002;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
try_files /autodiscover-json.php =404;
}
location ~ /(?:m|M)ail/(?:c|C)onfig-v1.1.xml {
2017-05-03 22:26:10 +02:00
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass phpfpm:9002;
2017-05-03 22:26:10 +02:00
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
try_files /autoconfig.php =404;
2017-02-28 11:02:02 +02:00
}
location ^~ /Microsoft-Server-ActiveSync {
2018-02-13 10:12:54 +02:00
include /etc/nginx/conf.d/sogo_eas.active;
2018-10-05 11:12:55 +02:00
proxy_connect_timeout 4000;
2017-02-28 11:02:02 +02:00
proxy_next_upstream timeout error;
2018-10-05 11:12:55 +02:00
proxy_send_timeout 4000;
proxy_read_timeout 4000;
2017-02-28 11:02:02 +02:00
proxy_buffer_size 8k;
2018-10-05 11:12:55 +02:00
proxy_buffers 16 64k;
2017-02-28 11:02:02 +02:00
proxy_temp_file_write_size 64k;
proxy_busy_buffers_size 64k;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
2017-02-28 11:02:02 +02:00
proxy_set_header x-webobjects-server-protocol HTTP/1.0;
proxy_set_header x-webobjects-remote-host $remote_addr;
proxy_set_header x-webobjects-server-name $server_name;
2017-05-03 22:26:10 +02:00
proxy_set_header x-webobjects-server-url $client_req_scheme://$http_host;
2017-04-25 10:49:38 +02:00
proxy_set_header x-webobjects-server-port $server_port;
2017-02-28 11:02:02 +02:00
client_body_buffer_size 128k;
2017-08-09 10:17:27 +02:00
client_max_body_size 0;
2017-02-28 11:02:02 +02:00
}
# auth_request endpoint if ALLOW_ADMIN_EMAIL_LOGIN is set
location /sogo-auth-verify {
internal;
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header Content-Length "";
proxy_pass http://127.0.0.1:80/sogo-auth;
proxy_pass_request_body off;
}
2017-02-28 11:02:02 +02:00
location ^~ /SOGo {
include /etc/nginx/conf.d/sogo.active;
2017-02-28 11:02:02 +02:00
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
2017-02-28 11:02:02 +02:00
proxy_set_header x-webobjects-server-protocol HTTP/1.0;
proxy_set_header x-webobjects-remote-host $remote_addr;
proxy_set_header x-webobjects-server-name $server_name;
2017-05-03 22:26:10 +02:00
proxy_set_header x-webobjects-server-url $client_req_scheme://$http_host;
2017-04-25 10:49:38 +02:00
proxy_set_header x-webobjects-server-port $server_port;
2017-02-28 11:02:02 +02:00
client_body_buffer_size 128k;
2017-08-09 10:17:27 +02:00
client_max_body_size 0;
2017-02-28 11:02:02 +02:00
break;
}
location /SOGo.woa/WebServerResources/ {
2018-12-21 20:54:32 +02:00
alias /usr/lib/GNUstep/SOGo/WebServerResources/;
2017-02-28 11:02:02 +02:00
}
location /.woa/WebServerResources/ {
2018-12-21 20:54:32 +02:00
alias /usr/lib/GNUstep/SOGo/WebServerResources/;
2017-02-28 11:02:02 +02:00
}
location /SOGo/WebServerResources/ {
2018-12-21 20:54:32 +02:00
alias /usr/lib/GNUstep/SOGo/WebServerResources/;
2017-02-28 11:02:02 +02:00
}
2018-02-14 10:09:17 +02:00
location (^/SOGo/so/ControlPanel/Products/[^/]*UI/Resources/.*\.(jpg|png|gif|css|js)$) {
2018-12-21 20:54:32 +02:00
alias /usr/lib/GNUstep/SOGo/$1.SOGo/Resources/$2;
2017-02-28 11:02:02 +02:00
}
include /etc/nginx/conf.d/site.*.custom;
2017-04-26 23:37:55 +02:00
}