flor3289

Apache vhost bleibt hängen

Hallo zusammen,

Vorgeschichte:
Alter HP-Server mit Proxmox. Dieser blieb über Nacht hängen, die Ursache konnte nicht weiter erforscht werden.
Manche VM-Dienste waren noch erreichbar, andere reagierten noch auf PING oder auch gar nicht mehr.
Der Proxmox-Server reagierte noch auf PING aber sonst nicht mehr.
Nach einem Reboot kam dieser nicht mehr hoch.
Die beiden SSDs die im Hardware Raid 1 laufen getrennt an normale PC-Hardware angeschlossen booteten normal.
Der Hardware Raid Controller meldete jedoch dass das Raid defekt wäre und ließ sich auch nicht mehr überreden.
Also Kurzerhand das Raid gelöscht und neu erstellt, Proxmox neu installiert und die beiden anderen Hardware Raids (HDDs) wieder eingebunden.
Dann die Konfig-Dateien aus dem Backup kopiert und die vorhandenen VMs wieder Startfähig gemacht.
Tägliche Backups sind vorhanden jedoch sah ich keine Notwendigkeit wenn die virtuellen Platten ja noch vorhanden sind.
VMs starteten alle, egal ob Linux oder Windows. Probleme gab es keine.
Nur...
Eine VM beherbergt unser Intranet welches erst kurz zuvor den Mitarbeitern zur Verfügung gestellt wurde. Auf der VM läuft Debian 12 (Bookworm) der Webserver (Apache2) lief bis dato nur zum testen und Inhalte einpflegen.
Auf diese VM laufen Intern mehrere DNS-Einträge (Intranet, "Was zum testen" und "ein weiteres Portal")
SSL wird nicht verwendet.
Die Sites sind unterteilt in 000-default.conf -> Wird mit einfacher HTML-Seite auf "intranet.xxx.de" weitergeleitet
Dann gibt es eben die sites: 001-intranet.conf, 002-"test".conf, 003-"portal".conf.
Somit wird ja über das DNS entschieden welcher Inhalt angezeigt wird. Was bisher auch in der Testphase problemlos funktionierte (über ein Jahr...)
Nun ist es aber (oft morgens) so das sich der Apache verschluckt. Dann wird anstelle intranet.xxx.de, die Umleitungsseite aus 000-default.conf angezeigt. Und er leitet dann immer wieder auf sich selbst um, kommt nicht zur richtigen Adresse und läd dann die HTML-Datei die eigentlich nur erscheinen soll wenn der Server über seine IP-Adresse angesprochen wird.
Das Problem hatte ich noch nie in Verbindung mit v-hosts, debian und Aapche2...
In den Logs finde ich nicht wirklich etwas.
Der Kollege startete bisher den Server (also die VM), wenn der Fehler auftrat neu, danach lief es wieder eine unbestimmte Zeit. Heute sagte er mir bescheid, habe selbst ein wenig ausprobiert und letztendlich den Dienst reloaded (systemctl reload apache2) und das Intranet war wieder erreichbar. Was komisch war: die anderen DNS gingen die ganze Zeit über...
Ich habe den morgendlichen reload nun mal als Cronjob angelegt, macht aber auf Dauer ja auch keinen Sinn.

Weiß hier jemand Rat? Updates sind aktuell. In den Logs konnte ich bisher gar nichts interessantes finden.
Ich habe für alle Sites ein getrenntes Access und Error Log was die Suche etwas eindämmt.
Auf Facebook teilen
Auf X (Twitter) teilen
Auf Reddit teilen
Auf Linkedin teilen

Content-ID: 673558

Url: https://administrator.de/forum/apache-vhost-probleme-intranet-673558.html

Ausgedruckt am: 26.06.2025 um 09:06 Uhr

SlainteMhath
SlainteMhath 26.06.2025 um 08:47:47 Uhr
Goto Top
Moin,

uff, eine Wall of Text und doch so wenig Info face-sad

000-default.conf -> Wird mit einfacher HTML-Seite auf "intranet.xxx.de" weitergeleitet
Bedeutet was? Redirect per 302? Oder old-school mit Javascript oder via reinem HTML-Header?

Was steht in den apache logs dazu?

lg,
Slainte
flor3289
flor3289 26.06.2025 aktualisiert um 09:27:15 Uhr
Goto Top
Hi Slainte,

die 000-default.conf zeigt nach /var/www/html

dort liegt einfach eine index.html
<meta http-equiv="refresh" content="10; URL=http://intranet.xxx.de">  

<body>Sie werden weitergeleitet [...] </body>

Die Logs: access.log
x.x.x.x - - [26/Jun/2025:07:06:14 +0200] "GET / HTTP/1.1" 200 585 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0"  
x.x.x.x - - [26/Jun/2025:07:06:14 +0200] "GET /favicon.ico HTTP/1.1" 404 497 "http://intranet.xxx.de/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0"  
x.x.x.x - - [26/Jun/2025:07:06:24 +0200] "GET / HTTP/1.1" 200 585 "http://intranet.xxx.de/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0"  
x.x.x.x - - [26/Jun/2025:07:06:34 +0200] "GET / HTTP/1.1" 200 585 "http://intranet.xxx.de/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0"  
x.x.x.x - - [26/Jun/2025:07:06:44 +0200] "GET / HTTP/1.1" 200 585 "http://intranet.xxx.de/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0"  
[...]
x.x.x.x - - [26/Jun/2025:07:14:41 +0200] "GET /favicon.ico HTTP/1.1" 404 497 "http://intranet.xxx.de/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0"  
[...]

error.log
[Thu Jun 26 00:00:04.571974 2025] [mpm_prefork:notice] [pid 525:tid 525] AH00163: Apache/2.4.62 (Debian) configured -- resuming normal operations
[Thu Jun 26 00:00:04.572071 2025] [core:notice] [pid 525:tid 525] AH00094: Command line: '/usr/sbin/apache2'  
[Thu Jun 26 07:36:20.538031 2025] [mpm_prefork:notice] [pid 525:tid 525] AH00171: Graceful restart requested, doing restart
[Thu Jun 26 07:36:20.635353 2025] [mpm_prefork:notice] [pid 525:tid 525] AH00163: Apache/2.4.62 (Debian) configured -- resuming normal operations
[Thu Jun 26 07:36:20.635384 2025] [core:notice] [pid 525:tid 525] AH00094: Command line: '/usr/sbin/apache2'  
flor3289
flor3289 26.06.2025 um 09:29:53 Uhr
Goto Top
Nach dem reload läuft das auch wieder ohne Probleme, gebe ich die IP direkt ein werde ich entsprechend auf die Subdomain weitergeleitet. Wieso manchmal die Subdomain selbst auf die default zeigt und das so plötzlich passierte verstehe ich nicht. Zumal die anderen Subdomains weiterlaufen...
SlainteMhath
SlainteMhath 26.06.2025 um 09:38:33 Uhr
Goto Top
Die Weiterleitung per meta-Tag ist rein Clientseitig. Warum machst du das nicht per "Redirect" Anweisung in deiner Apache-Conf?

Dann wird anstelle intranet.xxx.de, die Umleitungsseite aus 000-default.conf angezeigt.
kannst du das genauer erklären? Welche URLs werden aufgerufen? Passen alle beteiligten DNS Records?
flor3289
flor3289 26.06.2025 um 09:43:30 Uhr
Goto Top
Vielen Dank für deine weiteren Infos
Wie stelle ich denn die Redirect Anweisung ein? Ich habe das immer nur per meta-Tag gemacht, einen weiteren Grund dazu gibt es nicht.
Was meinst du mit "Welche URLs werden aufgerufen?" rein das intranet. Der Server bzw, die VM befindet sich im selben Netz wie die Clients.
DNS macht die Windows-Domäne, daran hatten wir auch nichts geändert, ich gehe davon aus, das passt soweit da die Einträge mit anderen internen Webservices übereinstimmen.
SlainteMhath
SlainteMhath 26.06.2025 um 09:58:35 Uhr
Goto Top
Wie stelle ich denn die Redirect Anweisung ein?
RTFM hilft face-smile https://httpd.apache.org/docs/2.4/mod/mod_alias.html


Was meinst du mit "Welche URLs werden aufgerufen?"
Ok, lass mich das in User-Speak umformulieren: Was wird in die Adressleiste des Browsers eingetippt, um auf euer Intranet zu kommen?
flor3289
flor3289 26.06.2025 um 10:14:44 Uhr
Goto Top
Hah danke!

http://intranet.xxx.de
ist aber auch per GPO gesetzt face-smile
SlainteMhath
SlainteMhath 26.06.2025 um 10:25:49 Uhr
Goto Top
Und warum, zur Hölle, brauchst du dann einen redirect ala
<meta http-equiv="refresh" content="10; URL=http://intranet.xxx.de">   
?

Das macht doch keinen Sinn!
flor3289
flor3289 26.06.2025 um 10:34:17 Uhr
Goto Top
Das war falls jemand die IP direkt eingeben sollte. Könnte natürlich auch die 000-default einfach auf das gleiche Verzeichnis zeigen lassen, da hast du recht.

Ansich ist das ja aber trotzdem erstmal kein Fehler, oder?
Mich fuchst nur, wo kommt plötzlich das Problem her...
SlainteMhath
SlainteMhath 26.06.2025 um 10:41:10 Uhr
Goto Top
Kannst du mal deine 000-default.conf und 001-intranet.conf posten?
flor3289
flor3289 26.06.2025 um 10:46:59 Uhr
Goto Top
ja aber sicher doch...
000-default.conf

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to 
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf". 
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

001-intranet.conf

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to 
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerName intranet.xxx.de
        DirectoryIndex index.html index.php
        ServerAdmin edv@xxx.de
        DocumentRoot /var/www/html/intranet/

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/intranet-error.log
        CustomLog ${APACHE_LOG_DIR}/intranet-access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf". 
        #Include conf-available/serve-cgi-bin.conf

        <Directory /var/www/html/joomla>
                Options FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>

</VirtualHost>