From c9b38f9825310a51c3ef48ab60567eb19113c03b Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Fri, 5 Dec 2025 08:57:11 +0100 Subject: [PATCH] Update apache-config-example.conf to improve static file handling and reverse proxy configuration. Disable DirectoryIndex to prevent serving index.html directly, and ensure all requests are routed to Node.js. Add comments for clarity on configuration rules. --- apache-config-example.conf | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apache-config-example.conf b/apache-config-example.conf index ddc36f5..8bdbee1 100644 --- a/apache-config-example.conf +++ b/apache-config-example.conf @@ -8,15 +8,21 @@ SSLCertificateFile /etc/letsencrypt/live/www.ypchat.net/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/www.ypchat.net/privkey.pem - # DocumentRoot (optional, falls statische Dateien direkt serviert werden sollen) + # DocumentRoot (nur für statische Dateien wie ads.txt) DocumentRoot /opt/ypchat/docroot + # WICHTIG: Deaktiviere DirectoryIndex, damit Apache keine index.html direkt serviert + # Alle Anfragen sollen an Node.js weitergeleitet werden + DirectoryIndex disabled + AllowOverride None Require all granted + # Verhindere, dass Apache index.html automatisch serviert + Options -Indexes - # Spezielle Regel für /ads.txt + # Spezielle Regel für /ads.txt (muss VOR ProxyPass stehen!) Alias /ads.txt /opt/ypchat/docroot/ads.txt Require all granted @@ -34,6 +40,7 @@ RewriteRule ^/?(.*) "ws://localhost:4000/$1" [P,L] # Reverse Proxy zu Node.js + # WICHTIG: ProxyPass muss ALLE Routen abfangen, auch / ProxyPreserveHost On ProxyPass /ads.txt ! ProxyPass / http://localhost:4000/