From bca4264336fc27ffd1c01d8bb13fbf8b2eefda77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 23 Feb 2024 19:40:20 +0100 Subject: [PATCH] Update nginx config from upstream --- conf/nginx.conf | 35 +++++++++++++++++++++++++++++------ scripts/_common.sh | 19 ++++++++++++++----- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 9ee8171..9e5f9ff 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,8 +1,9 @@ # SOGo Proxying #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location ^~ __PATH__/ { +location ^~/SOGo/ +{ proxy_pass http://127.0.0.1:__PORT__; - proxy_redirect http://127.0.0.1:__PORT__/SOGo/ /SOGo; + proxy_redirect http://127.0.0.1:__PORT__ default; # forward user's IP address proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -11,17 +12,39 @@ location ^~ __PATH__/ { proxy_set_header x-webobjects-remote-host 127.0.0.1; proxy_set_header x-webobjects-server-name $server_name; proxy_set_header x-webobjects-server-url $scheme://$host; + proxy_set_header x-webobjects-server-port $server_port; + proxy_connect_timeout 90; + proxy_send_timeout 90; + proxy_read_timeout 90; + proxy_buffer_size 8k; + proxy_buffers 4 64k; + proxy_busy_buffers_size 64k; + proxy_temp_file_write_size 64k; + break; + include conf.d/yunohost_panel.conf.inc; client_max_body_size 100M; } - -location __PATH__.woa/WebServerResources/ { +location /SOGo.woa/WebServerResources/ +{ alias /usr/lib/GNUstep/SOGo/WebServerResources/; + allow all; + expires max; } -location __PATH__/WebServerResources/ { +location /SOGo/WebServerResources/ +{ alias /usr/lib/GNUstep/SOGo/WebServerResources/; + allow all; + expires max; } -location ^__PATH__/so/ControlPanel/Products/([^/]*)/Resources/(.*)$ { +location (^/SOGo/so/ControlPanel/Products/([^/]*)/Resources/(.*)$)/ +{ alias /usr/lib/GNUstep/SOGo/$1.SOGo/Resources/$2; + expires max; +} +location (^/SOGo/so/ControlPanel/Products/[^/]*UI/Resources/.*\.(jpg|png|gif|css|js)$)/ +{ + alias /usr/lib/GNUstep/SOGo/$1.SOGo/Resources/$2; + expires max; } diff --git a/scripts/_common.sh b/scripts/_common.sh index 64859a4..c3d16fa 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,7 +9,7 @@ #================================================= config_nginx() { - nginx_config="/etc/nginx/conf.d/$domain/$app.conf" + nginx_config="/etc/nginx/conf.d/$domain.d/$app.conf" # shellcheck disable=SC2016 principals_block=' @@ -21,19 +21,28 @@ location = /principals/ { # shellcheck disable=SC2016 activesync_block=' # For ActiveSync -location /Microsoft-Server-ActiveSync/ { - proxy_pass http://127.0.0.1:__PORT__/SOGo/Microsoft-Server-ActiveSync/; +location ^~ /Microsoft-Server-ActiveSync { + proxy_connect_timeout 75; + proxy_send_timeout 3600; + proxy_read_timeout 3600; + proxy_buffers 64 256k; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_pass http://127.0.0.1:'$port'/SOGo/Microsoft-Server-ActiveSync; }' # shellcheck disable=SC2016 caldav_block=' # For Caldav -location /.well-known/caldav { +location = /.well-known/caldav { rewrite ^ https://$server_name/SOGo/dav/; }' # shellcheck disable=SC2016 carddav_block=' # For Carddav -location /.well-known/carddav { +location = /.well-known/carddav { rewrite ^ https://$server_name/SOGo/dav/; }'