Fix: Webmail-Vhost serviert volle Laravel-App statt nur /webmail/*

Mit dedizierter Webmail-Subdomain ist kein /webmail/-Präfix nötig —
Laravel's domain()-Routing in bootstrap/app.php übernimmt die Isolation.
Nur / leitet auf /login um, alle anderen Pfade gehen direkt an Laravel.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main v1.1.151
boban 2026-04-23 03:02:15 +02:00
parent 46fb3f12ff
commit 12a16dbd64
1 changed files with 6 additions and 10 deletions

View File

@ -403,7 +403,7 @@ build_webmail_http_only(){
[[ "${DEV_MODE}" = "1" && "${def_flag}" = "default" ]] && def=" default_server" [[ "${DEV_MODE}" = "1" && "${def_flag}" = "default" ]] && def=" default_server"
[[ -z "${host}" || "${host}" = "_" ]] && host="_" [[ -z "${host}" || "${host}" = "_" ]] && host="_"
cat > "$outfile" <<CONF cat > "$outfile" <<CONF
# --- ${host} : Webmail (nur /webmail/*) --- # --- ${host} : Webmail (domain-routing, volle Laravel-App) ---
server { server {
listen 80${def}; listen 80${def};
listen [::]:80${def}; listen [::]:80${def};
@ -414,13 +414,11 @@ server {
access_log /var/log/nginx/${host/_/__}_webmail_access.log; access_log /var/log/nginx/${host/_/__}_webmail_access.log;
error_log /var/log/nginx/${host/_/__}_webmail_error.log; error_log /var/log/nginx/${host/_/__}_webmail_error.log;
client_max_body_size 25m; client_max_body_size 25m;
location = / { return 301 /webmail/login; } location = / { return 301 http://\$host/login; }
location = /login { return 301 /webmail/login; } location / { try_files \$uri \$uri/ /index.php?\$query_string; }
location ^~ /webmail/ { try_files \$uri \$uri/ /index.php?\$query_string; }
location ~ \.php\$ { include snippets/fastcgi-php.conf; ${FASTCGI_PASS} } location ~ \.php\$ { include snippets/fastcgi-php.conf; ${FASTCGI_PASS} }
location ^~ /livewire/ { try_files \$uri /index.php?\$query_string; } location ^~ /livewire/ { try_files \$uri /index.php?\$query_string; }
location ~* \.(css|js|ico|svg|woff2?|ttf|jpg|jpeg|png|gif)\$ { expires 30d; access_log off; } location ~* \.(css|js|ico|svg|woff2?|ttf|jpg|jpeg|png|gif)\$ { expires 30d; access_log off; }
location / { return 403; }
} }
CONF CONF
} }
@ -428,7 +426,7 @@ CONF
build_webmail_tls(){ build_webmail_tls(){
local host="$1" cert_dir="$2" outfile="$3" local host="$1" cert_dir="$2" outfile="$3"
cat > "$outfile" <<CONF cat > "$outfile" <<CONF
# --- ${host} : Webmail TLS (nur /webmail/*) --- # --- ${host} : Webmail TLS (domain-routing, volle Laravel-App) ---
server { server {
listen 80; listen [::]:80; server_name ${host}; listen 80; listen [::]:80; server_name ${host};
location ^~ /.well-known/acme-challenge/ { root ${ACME_ROOT}; allow all; } location ^~ /.well-known/acme-challenge/ { root ${ACME_ROOT}; allow all; }
@ -446,13 +444,11 @@ server {
access_log /var/log/nginx/${host}_webmail_ssl_access.log; access_log /var/log/nginx/${host}_webmail_ssl_access.log;
error_log /var/log/nginx/${host}_webmail_ssl_error.log; error_log /var/log/nginx/${host}_webmail_ssl_error.log;
client_max_body_size 25m; client_max_body_size 25m;
location = / { return 301 https://\$host/webmail/login; } location = / { return 301 https://\$host/login; }
location = /login { return 301 https://\$host/webmail/login; } location / { try_files \$uri \$uri/ /index.php?\$query_string; }
location ^~ /webmail/ { try_files \$uri \$uri/ /index.php?\$query_string; }
location ~ \.php\$ { include snippets/fastcgi-php.conf; ${FASTCGI_PASS} } location ~ \.php\$ { include snippets/fastcgi-php.conf; ${FASTCGI_PASS} }
location ^~ /livewire/ { try_files \$uri /index.php?\$query_string; } location ^~ /livewire/ { try_files \$uri /index.php?\$query_string; }
location ~* \.(css|js|ico|svg|woff2?|ttf|jpg|jpeg|png|gif)\$ { expires 30d; access_log off; } location ~* \.(css|js|ico|svg|woff2?|ttf|jpg|jpeg|png|gif)\$ { expires 30d; access_log off; }
location / { return 403; }
} }
CONF CONF
} }