Backup before adding SMTP stream proxy configuration

This commit is contained in:
root
2026-01-23 11:02:06 +01:00
parent 62d24a96af
commit ef16045880
44 changed files with 2516 additions and 319 deletions

View File

@@ -1,167 +1,161 @@
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
proxy_cache_path /tmp/owa/ levels=1:2 keys_zone=my_cache_owa:10m max_size=10g
inactive=60m use_temp_path=off;
# Optimized cache paths
proxy_cache_path /var/cache/nginx/kopano levels=1:2 keys_zone=kopano_static:10m
max_size=2g inactive=24h use_temp_path=off;
# Upstream with connection pooling
upstream kopano_backend {
server 10.0.0.21:443;
keepalive 32;
keepalive_requests 1000;
keepalive_timeout 60s;
}
server{
listen 80;
server_name owa.egonetix.de autodiscover.egonetix.de mail.egonetix.de;
return 301 https://$server_name/webapp$request_uri;
# WebSocket support map
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 10.0.0.29:443 ssl http2;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# SSL config
ssl on;
ssl_certificate /etc/letsencrypt/live/owa.egonetix.de/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/owa.egonetix.de/privkey.pem;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
# Make site accessible from http://localhost/
server_name owa.egonetix.de autodiscover.egonetix.de mail.egonetix.de;
access_log /var/log/nginx/owa-access_log;
error_log /var/log/nginx/owa-error_log;
set $upstream 10.0.0.21;
rewrite ^/$ /webapp;
location /webapp {
proxy_cache my_cache_owa;
proxy_cache_revalidate on;
proxy_cache_min_uses 3;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_lock on;
proxy_pass_header Authorization;
proxy_pass https://$upstream;
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_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
proxy_ssl_session_reuse off;
}
location /Microsoft-Server-ActiveSync {
proxy_cache my_cache_owa;
proxy_cache_revalidate on;
proxy_cache_min_uses 3;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_lock on;
proxy_pass_header Authorization;
proxy_pass https://$upstream;
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_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
proxy_ssl_session_reuse off;
}
location /webmeetings {
proxy_cache my_cache_owa;
proxy_cache_revalidate on;
proxy_cache_min_uses 3;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_lock on;
proxy_pass_header Authorization;
proxy_pass https://$upstream;
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_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
proxy_ssl_session_reuse off;
listen 80;
server_name owa.egonetix.de autodiscover.egonetix.de mail.egonetix.de;
return 301 https://$server_name$request_uri;
}
location ~* /Autodiscover/Autodiscover.xml {
access_log /var/log/nginx/z-push-autodiscover-access.log;
error_log /var/log/nginx/z-push-autodiscover-error.log;
fastcgi_param SCRIPT_FILENAME /usr/share/z-push/autodiscover/autodiscover.php;
fastcgi_param HTTP_PROXY ""; # Mitigate https://httpoxy.org/ vulnerabilities
fastcgi_read_timeout 3660; # Z-Push Ping might run 3600s, but to be safe
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
include fastcgi_params;
proxy_cache my_cache_owa;
proxy_cache_revalidate on;
proxy_cache_min_uses 3;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_lock on;
proxy_pass_header Authorization;
proxy_pass https://$upstream;
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_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
proxy_ssl_session_reuse off;
server {
listen 10.0.0.29:443 ssl http2;
# SSL config
ssl_certificate /etc/letsencrypt/live/owa.egonetix.de/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/owa.egonetix.de/privkey.pem;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
server_name owa.egonetix.de autodiscover.egonetix.de mail.egonetix.de;
access_log /var/log/nginx/owa-access_log;
error_log /var/log/nginx/owa-error_log;
# Gzip compression
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 5;
gzip_types text/plain text/css text/xml text/javascript
application/json application/javascript application/xml+rss
application/x-javascript image/svg+xml;
gzip_min_length 1000;
# Default proxy settings
proxy_http_version 1.1;
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_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Connection "";
proxy_ssl_session_reuse on;
proxy_ssl_server_name on;
rewrite ^/$ /webapp redirect;
# Static files - aggressive caching
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
proxy_pass https://kopano_backend;
proxy_cache kopano_static;
proxy_cache_valid 200 24h;
proxy_cache_valid 404 1m;
expires 24h;
add_header Cache-Control "public, immutable";
# Buffering for static files
proxy_buffering on;
proxy_buffer_size 8k;
proxy_buffers 32 8k;
}
# WebApp - DISABLE buffering for AJAX responsiveness
location /webapp {
proxy_pass https://kopano_backend;
# NO caching
proxy_no_cache 1;
proxy_cache_bypass 1;
# DISABLE buffering for instant AJAX responses
proxy_buffering off;
proxy_read_timeout 300s;
client_max_body_size 100M;
proxy_redirect off;
}
# ActiveSync - disable buffering for real-time sync
location /Microsoft-Server-ActiveSync {
proxy_pass https://kopano_backend;
proxy_no_cache 1;
proxy_cache_bypass 1;
proxy_buffering off;
proxy_read_timeout 3660s;
client_max_body_size 100M;
proxy_redirect off;
}
# WebMeetings - WebSocket support
location /webmeetings {
proxy_pass https://kopano_backend;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_buffering off;
proxy_read_timeout 7200s;
client_max_body_size 500M;
proxy_redirect off;
}
# Autodiscover
location ~* /Autodiscover/Autodiscover.xml {
access_log /var/log/nginx/z-push-autodiscover-access.log;
error_log /var/log/nginx/z-push-autodiscover-error.log;
proxy_pass https://kopano_backend;
proxy_no_cache 1;
proxy_cache_bypass 1;
proxy_buffering off;
proxy_read_timeout 60s;
client_max_body_size 10M;
proxy_redirect off;
}
# OWA compatibility
location /owa {
proxy_pass https://kopano_backend;
proxy_no_cache 1;
proxy_cache_bypass 1;
proxy_buffering off;
proxy_read_timeout 300s;
client_max_body_size 100M;
proxy_redirect off;
}
# CalDAV
location /caldav {
proxy_pass http://10.0.0.21:8080;
proxy_no_cache 1;
proxy_cache_bypass 1;
proxy_buffering off;
proxy_read_timeout 300s;
client_max_body_size 50M;
proxy_redirect off;
}
}
location /owa {
proxy_cache my_cache_owa;
proxy_cache_revalidate on;
proxy_cache_min_uses 3;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_lock on;
proxy_pass_header Authorization;
proxy_pass https://$upstream;
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_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
proxy_ssl_session_reuse off;
}
location /caldav {
proxy_cache my_cache_owa;
proxy_cache_revalidate on;
proxy_cache_min_uses 3;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_lock on;
proxy_pass_header Authorization;
proxy_pass http://$upstream:8080;
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_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
proxy_ssl_session_reuse off;
}
}